BigMemory 4.3.10 | Product Documentation | BigMemory Max Developer Guide | Cluster Events | Troubleshooting
 
Troubleshooting
In most cases, the Terracotta Cluster Events API behaves as expected. Unexpected results can occur under the circumstances described below.
getCluster Returns Null For Programmatically Created CacheManagers
If a CacheManager instance is created and configured programmatically (without an ehcache.xml or other external configuration resource), getCluster("TERRACOTTA") might return null even if a Terracotta cluster exists. To ensure that cluster information is returned in this case, get a cache that is clustered with Terracotta:
// mgr created and configured programmatically.
CacheManager mgr = new CacheManager();
// myCache has Terracotta clustering.
Cache cache = mgr.getEhcache("myCache");
// A Terracotta client has started, making available cluster information.
CacheCluster cluster = mgr.getCluster("TERRACOTTA");
nodeJoined for the Current Node {#68163}
Since the current node joins the cluster before code adding the topology listener runs, the current node may never receive the nodeJoined event. You can detect if the current node is in the cluster by checking whether the cluster is online:
cluster.addTopologyListener(cacheListener);
if(cluster.isClusterOnline()) {
cacheListener.clusterOnline(cluster.getCurrentNode());
}
Multiple NodeJoined Events in the Same JVM
Since multiple Terracotta clients can exist in the same JVM, multiple NodeJoined events can be generated in that JVM. Remote clients will not be able to differentiate between the clients that generated the NodeJoined events.