Class Graceful.Shutdown

java.lang.Object
org.eclipse.jetty.util.component.Graceful.Shutdown
All Implemented Interfaces:
Graceful
Enclosing interface:
Graceful

public abstract static class Graceful.Shutdown extends Object implements Graceful
A utility class to assist implementing the Graceful interface. The isShutdownDone() method should be implemented to check if the CompletableFuture returned by shutdown() should be completed or not. The check() method should be called when any state is changed which may complete the shutdown.
  • Constructor Details

    • Shutdown

      protected Shutdown(Object component)
  • Method Details

    • shutdown

      public CompletableFuture<Void> shutdown()
      Description copied from interface: Graceful
      Shutdown the component. When this method returns, the component should not accept any new load.
      Specified by:
      shutdown in interface Graceful
      Returns:
      A future that is completed once all load on the component is completed
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface Graceful
      Returns:
      True if Graceful.shutdown() has been called.
    • check

      public void check()
      This method should be called whenever the components state has been updated. If shutdown() has been called, then isShutdownDone() is called by this method and if it returns true then the Future returned by shutdown() is completed.
    • cancel

      public void cancel()
    • isShutdownDone

      public abstract boolean isShutdownDone()
      Returns:
      True if the component is shutdown and has no remaining load.