net.i2p.router.tasks

## Class GracefulShutdown

- java.lang.Object
- - net.i2p.router.tasks.GracefulShutdown

- All Implemented Interfaces:
    Runnable

      public class GracefulShutdown
      extends Object
      implements Runnable

  GracefulShutdown manages the router's graceful shutdown/restart lifecycle. Uses configurable timings to control when to re-check state and how long to wait before finalizing a restart/shutdown after signaling.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GracefulShutdown(RouterContext ctx)` Create a new graceful shutdown handler.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `run()`
    `void` | `stop()` Stop the shutdown thread gracefully.
    `void` | `wakeUp()` Wake up the shutdown thread when a relevant state change occurs.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GracefulShutdown

          public GracefulShutdown(RouterContext ctx)

      Create a new graceful shutdown handler.
      Parameters:
        `ctx` - the router context for accessing router state and services

  - ### Method Detail

    - #### run

          public void run()

      Specified by:
        `run` in interface `Runnable`

    - #### 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.

    - #### 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.