Class ShutdownManager
java.lang.Object
org.keycloak.connections.infinispan.shutdown.ShutdownManager
Manages an ordered list of
ShutdownListener instances that are notified sequentially when the server shuts
down.
Listeners are invoked in registration order. Each listener may block the calling thread to delay shutdown until its condition is met (e.g. waiting for a stable cache topology). All listeners share the same deadline, so the total shutdown time is bounded regardless of how many listeners are registered. It is recommended to respect it.
If onShutdownStarted(Instant) is called before onShutdown() (e.g. from a shutdown delay event), the
deadline is anchored to that earlier timestamp. Otherwise, it falls back to the current time when
onShutdown() is invoked.
This class is thread-safe: listeners can be added or removed concurrently.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(ShutdownListener listener) voidvoidonShutdownStarted(Instant shutdownStartTime) Records the instant the shutdown sequence began (e.g.voidremoveListener(ShutdownListener listener)
-
Constructor Details
-
ShutdownManager
public ShutdownManager(long shutdownDelay, long shutdownTimeout)
-
-
Method Details
-
addListener
-
removeListener
-
onShutdown
public void onShutdown() -
onShutdownStarted
Records the instant the shutdown sequence began (e.g. when the shutdown delay was initiated by Quarkus).- Parameters:
shutdownStartTime- The instant the shutdown was initiated.
-