Class TopologyChangeCacheListener
java.lang.Object
org.keycloak.connections.infinispan.shutdown.TopologyChangeCacheListener
An Infinispan cache listener that delays server shutdown until the cache topology is stable (i.e. no rehash is in
progress).
Use waitForStableTopology(Cache) to register this listener on a cache. It returns a
WaitConditionShutdownListener that should be added to the ShutdownManager.
Limitation: when two or more Keycloak instances receive a shutdown signal simultaneously, each instance may observe a stable topology before any of them have actually left the cluster. In this scenario, all instances proceed with shutdown concurrently, increasing the risk of data loss.
-
Method Summary
Modifier and TypeMethodDescriptionvoidonTopologyChange(org.infinispan.notifications.cachelistener.event.TopologyChangedEvent<?, ?> event) waitForStableTopology(org.infinispan.Cache<?, ?> cache) Registers a topology change listener on the given cache and returns aWaitConditionShutdownListenerthat blocks shutdown while the cache topology is unstable.
-
Method Details
-
waitForStableTopology
Registers a topology change listener on the given cache and returns aWaitConditionShutdownListenerthat blocks shutdown while the cache topology is unstable.- Parameters:
cache- The cache to monitor for topology changes.- Returns:
- A
WaitConditionShutdownListenerto be registered with theShutdownManager.
-
onTopologyChange
public void onTopologyChange(org.infinispan.notifications.cachelistener.event.TopologyChangedEvent<?, ?> event)
-