Package com.tnsai.server.health
Class IdleShutdownManager
java.lang.Object
com.tnsai.server.health.IdleShutdownManager
Auto-shuts down the server after a configurable idle period (default: 30 min)
when no active WebSocket connections exist (ADR-2).
-
Constructor Summary
ConstructorsConstructorDescriptionIdleShutdownManager(WsConnectionManager connectionManager, Duration idleTimeout, Runnable shutdownAction) -
Method Summary
-
Constructor Details
-
IdleShutdownManager
public IdleShutdownManager(WsConnectionManager connectionManager, Duration idleTimeout, Runnable shutdownAction)
-
-
Method Details
-
onConnectionOpened
public void onConnectionOpened()Called when a connection is established. Cancels any pending shutdown. -
onConnectionClosed
public void onConnectionClosed()Called when a connection is closed. If no more connections exist, schedules shutdown after the idle timeout. -
start
public void start()Start monitoring. If no connections exist at start, schedule shutdown. -
stop
public void stop()
-