Class MultiClusterControlSupport
MultiClusterGigaSpace - everything
that configures the proxy rather than touching a space.
It is a plain class, not an implementation of the interface: the interface also declares 189
GigaSpace methods, which the router places on clusters instead.
DefaultMultiClusterGigaSpace forwards its
OperationKind.CONTROL methods straight here, and MultiClusterControlCompletenessTest
fails the build if any control method has no counterpart.
Thread-safe: the topology lives in ClusterRegistry's copy-on-write state and the
configuration in an AtomicReference, so a setXxx swaps one whole valid configuration for
another and an in-flight operation never sees a half-applied change.
-
Constructor Summary
ConstructorsConstructorDescriptionMultiClusterControlSupport(ClusterRegistry registry, MultiClusterConfig config, MultiClusterStatsRecorder stats) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClusterEventListener(ClusterEventListener listener) voidbooleanaddClusterToPriorityList(String clusterName) booleanaddClusterToReadRotation(String clusterName) voidattachHealth(HealthMonitor healthMonitor, FailoverManager failoverManager) Attaches the health machinery once it exists.voidDrops the read pin, soREAD_ACTIVEreads follow the active cluster again.The health state of every cluster, for diagnostics.The current configuration; routing code reads this once per operation.voidPromotes the next healthy cluster in failover order.getCluster(String clusterName) getClusterName(GigaSpace spaceProxy) intbooleanisClusterHealthy(String clusterName) Whether the cluster is healthy, according to the health monitor's windowed state - or a live ping if nothing has been observed yet, so a freshly registered cluster gives a real answer rather than an assumption.booleanisClusterHealthy(GigaSpace spaceProxy) Registered listeners, for tests and diagnostics.voidnotifyListeners(String previousName, GigaSpace previousProxy, String newName, GigaSpace newProxy, Throwable cause) Notifies listeners off the data path.voidonClusterFailed(String clusterName, Throwable cause, boolean unregister) Reports a cluster that could not be reached, and removes it only when the mode in force asks for that.voidpublish(ClusterEvent event) Publishes a typed event, on the same off-the-data-path executor the state listeners use.voidregisterCluster(String clusterName, GigaSpace spaceProxy) registry()voidbooleanremoveClusterFromPriorityList(String clusterName) booleanremoveClusterFromReadRotation(String clusterName) voidvoidsetActiveCluster(String clusterName) Moves both roles toclusterName: mutations, andREAD_ACTIVEreads with any pin dropped.voidsetActiveCluster(GigaSpace spaceProxy) voidsetClusterPriorityList(List<String> priorityNames) voidvoidsetFailureThreshold(int consecutiveFailuresThreshold) voidsetFailureWindow(Duration failureWindow) voidsetReadActiveCluster(String clusterName) PinsREAD_ACTIVEreads toclusterName, leaving the write role where it is.voidvoidsetWriteActiveCluster(String clusterName) Moves only the write role.voidvoidshutdown()Stops the listener executor.stats()voidunregisterCluster(String clusterName) voidunregisterCluster(GigaSpace spaceProxy)
-
Constructor Details
-
MultiClusterControlSupport
public MultiClusterControlSupport(ClusterRegistry registry, MultiClusterConfig config, MultiClusterStatsRecorder stats)
-
-
Method Details
-
attachHealth
Attaches the health machinery once it exists. The monitor needs this object's configuration and this object needs the monitor's verdicts, so the cycle is broken by wiring after construction rather than by passing half-built objects around. -
currentConfig
The current configuration; routing code reads this once per operation. -
registry
-
registerCluster
-
unregisterCluster
-
unregisterCluster
-
setActiveCluster
Moves both roles toclusterName: mutations, andREAD_ACTIVEreads with any pin dropped. -
setActiveCluster
-
setWriteActiveCluster
Moves only the write role. A pinned read cluster keeps the reads; without a pin they follow. -
getActiveClusterName
-
getActiveCluster
-
setReadActiveCluster
PinsREAD_ACTIVEreads toclusterName, leaving the write role where it is. -
clearReadActiveCluster
public void clearReadActiveCluster()Drops the read pin, soREAD_ACTIVEreads follow the active cluster again. -
getReadActiveClusterName
-
getReadActiveCluster
-
getRegisteredClusters
-
getCluster
-
getClusterName
-
setWriteMode
-
getWriteMode
-
setReadMode
-
getReadMode
-
setFailoverPolicy
-
getFailoverPolicy
-
setClusterPriorityList
-
getClusterPriorityList
-
addClusterToPriorityList
-
removeClusterFromPriorityList
-
getReadRotation
-
addClusterToReadRotation
-
removeClusterFromReadRotation
-
onClusterFailed
Reports a cluster that could not be reached, and removes it only when the mode in force asks for that.Reached from a health transition, so every route into it ends here: a run of failed reads crossing
failureThreshold, a health-check ping that got no answer, and a mutation that could not reach the cluster.unregisterisWRITE_SYNC's verdict and nobody else's. Under that mode every cluster was supposed to take the write, so one that did not is behind the others and serving stale reads; it leaves the topology. Under every other mode the cluster has missed nothing the proxy is responsible for, so it keeps its place in both lists and the application decides from theCLUSTER_FAILEDevent whether it should eventually go. -
setFailureThreshold
public void setFailureThreshold(int consecutiveFailuresThreshold) -
getFailureThreshold
public int getFailureThreshold() -
setFailureWindow
-
getFailureWindow
-
isClusterHealthy
Whether the cluster is healthy, according to the health monitor's windowed state - or a live ping if nothing has been observed yet, so a freshly registered cluster gives a real answer rather than an assumption. -
isClusterHealthy
-
failoverToNextCluster
public void failoverToNextCluster()Promotes the next healthy cluster in failover order.- Throws:
NoAvailableClusterException- if no other cluster is healthy
-
clusterStates
The health state of every cluster, for diagnostics. -
addClusterStateListener
-
removeClusterStateListener
-
addClusterEventListener
-
removeClusterEventListener
-
publish
Publishes a typed event, on the same off-the-data-path executor the state listeners use. -
listeners
Registered listeners, for tests and diagnostics. -
notifyListeners
public void notifyListeners(String previousName, GigaSpace previousProxy, String newName, GigaSpace newProxy, Throwable cause) Notifies listeners off the data path. A listener that blocks delays notifications only, and one that throws is logged rather than allowed to break the operation that triggered the change. -
stats
-
shutdown
public void shutdown()Stops the listener executor. Called by the handler'sclose().
-