BigMemory Max 4.3.4 | Product Documentation | BigMemory Max Developer Guide | Cache Event Listeners | Running Multiple Listeners on Separate Nodes
 
Running Multiple Listeners on Separate Nodes
The following is an example of running multiple event listeners on separate nodes.
If a listener B in one node is listening for an event generated by the action of listener A on another node, it will fail to receive an event unless listener A performs the action in a different thread.
For example, if listener A detects a put into cache A and in turn puts an element into cache B, then listener B should receive an event (if it is correctly registered to cache B). However, with the following code, listener B would fail to receive the event generated by the put:
// This method is within listener A
public void notifyElementPut(...) {
...
...
cache.put(...);
...
...
}
The following code allows listener B to receive the event:
// This method is within listener A
public void notifyElementPut(...) {
executorService.execute(new Runnable() {
public void run()
{
...
...
cache.put(...);
...
...
}
...
...
}
...

Copyright © 2010 - 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.