Product Documentation : Big Memory Max High-Availability Guide : Configuring Reconnection and Rejoin Properties : Using Rejoin to Reconnect Terracotta Clients
Using Rejoin to Reconnect Terracotta Clients
A Terracotta client may disconnect and be timed out (ejected) from the cluster. Typically, this occurs because of network communication interruptions lasting longer than the configured HA settings for the cluster. Other causes include long GC pauses and slowdowns introduced by other processes running on the client hardware.
You can configure clients to automatically rejoin a cluster after they are ejected. If the ejected client continues to run under nonstop cache settings, and then senses that it has reconnected to the cluster (receives a clusterOnline event), it can begin the rejoin process.
Note the following about using the rejoin feature:
*Disconnected clients can only rejoin clusters to which they were previously connected.
*Clients rejoin as new members and will wipe all cached data to ensure that no pauses or inconsistencies are introduced into the cluster.
*Clients cannot rejoin a new cluster; if the TSA has been restarted and its data has not been persisted, clients can never rejoin and must be restarted.
*If the TSA has been restarted and its data has been persisted, clients are allowed to rejoin.
*Any nonstop-related operations that begin (and do not complete) before the rejoin operation completes may be unsuccessful and may generate a NonStopCacheException.
*If a Terracotta client with rejoin enabled is running in a JVM with clients that do not have rejoin, then only that client will rejoin after a disconnection. The remaining clients cannot rejoin and may cause the application to behave unpredictably.
*Once a client rejoins, the clusterRejoined event is fired on that client only.
Configuring Rejoin
The rejoin feature is disabled by default. To enable the rejoin feature in an Terracotta client, follow these steps:
1. Ensure that all of the caches in the Ehcache configuration file where rejoin is enabled have nonstop enabled.
2. Ensure that your application does not create caches on the client without nonstop enabled.
3. Enable the rejoin attribute in the client's <terracottaConfig> element:
<terracottaConfig url="myHost:9510" rejoin="true" />
For more options on configuring <terracottaConfig>, see "Terracotta Clustering Configuration Elements" in the BigMemory Max Configuration Guide.
Exception During Rejoin
Under certain circumstances, if a lock is being used by your application, an InvalidLockAfterRejoinException could be thrown during or after client rejoin. This exception occurs when an unlock operation takes place on a lock obtained before the rejoin attempt completed.
To ensure that locks are released properly, application code should encapsulate lock-unlock operations with try-finally blocks:
myLock.acquireLock();
try {
// Do some work.
} finally {
myLock.unlock();
}
Copyright © 2010-2017 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback