java.lang.Object
net.i2p.router.tasks.GracefulShutdown
- All Implemented Interfaces:
Runnable
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RouterContextThe router being shut down.private final ObjectHeld while waiting between passes.private static final intInterval between status checks while a restart/shutdown is in progress (ms).private static final intDelay before finalizing a restart/shutdown after a signaling condition is met (ms).private booleanCleared to let the loop finish.Constructor Summary
ConstructorsMethod Summary
Field Details
_context
The router being shut down.running
private volatile boolean runningCleared to let the loop finish._wakeLock
Held while waiting between passes.RESTART_DELAY_MS
private static final int RESTART_DELAY_MSDelay before finalizing a restart/shutdown after a signaling condition is met (ms).- See Also:
CHECK_STATUS_INTERVAL_MS
private static final int CHECK_STATUS_INTERVAL_MSInterval between status checks while a restart/shutdown is in progress (ms).- See Also:
Constructor Details
GracefulShutdown
Create a new graceful shutdown handler.- Parameters:
ctx- the router context for accessing router state and services
Method Details
getWakeLock
The lock object for wake/sleep coordination with the shutdown detector.- Returns:
- the shared lock object
run
wakeUp
public void wakeUp()Wake up the shutdown thread when a relevant state change occurs. This method should be called when the router's shutdown state changes to prompt the graceful shutdown thread to re-evaluate the current situation.stop
public void stop()Stop the shutdown thread gracefully. Sets the running flag to false and wakes up the thread to allow it to exit cleanly. This should be called during router shutdown to properly terminate the graceful shutdown monitor.