Module io.jooby
Package io.jooby

Class GracefulShutdown

java.lang.Object
io.jooby.GracefulShutdown
All Implemented Interfaces:
Extension

public class GracefulShutdown extends Object implements Extension
Install a handler that at application shutdown time:

- Waits for existing requests to finished with an optional timeout - Incoming requests are resolved as Service Unavailable(503)

NOTE: This extension must be installed at very beginning of your route pipeline.

Author:
edgar
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new shutdown handler and waits for existing request to finish.
    Creates a new shutdown handler and waits for existing requests to finish or for specified amount of time.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    install(Jooby application)
    Install, configure additional features to a Jooby application.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.jooby.Extension

    lateinit
  • Constructor Details

    • GracefulShutdown

      public GracefulShutdown(@NonNull Duration await)
      Creates a new shutdown handler and waits for existing requests to finish or for specified amount of time.
      Parameters:
      await - Max time to wait for handlers to complete.
    • GracefulShutdown

      public GracefulShutdown()
      Creates a new shutdown handler and waits for existing request to finish.
  • Method Details

    • install

      public void install(@NonNull Jooby application) throws Exception
      Description copied from interface: Extension
      Install, configure additional features to a Jooby application.
      Specified by:
      install in interface Extension
      Parameters:
      application - Jooby application.
      Throws:
      Exception - If something goes wrong.