Module io.ebean.api

Class ShutdownManager

java.lang.Object
io.ebean.event.ShutdownManager

public final class ShutdownManager extends Object
Manages the shutdown of Ebean.

Makes sure all the resources are shutdown properly and in order.

  • Method Details

    • registerContainer

      public static void registerContainer(SpiContainer ebeanContainer)
      Registers the container (potentially with cluster management).
    • touch

      public static void touch()
      Make sure the ShutdownManager is activated.
    • isStopping

      public static boolean isStopping()
      Return true if the system is in the process of stopping.
    • deregisterShutdownHook

      public static void deregisterShutdownHook()
      Deregister the Shutdown hook.

      In calling this method it is expected that application code will invoke the shutdown() method.

      For running in a Servlet Container a redeploy will cause a shutdown, and for that case we need to make sure the shutdown hook is deregistered.

    • shutdown

      public static void shutdown()
      Shutdown gracefully cleaning up any resources as required.

      This is typically invoked via JVM shutdown hook.

    • registerDatabase

      public static void registerDatabase(Database server)
      Register an ebeanServer to be shutdown when the JVM is shutdown.
    • unregisterDatabase

      public static void unregisterDatabase(Database server)
      Deregister an ebeanServer.

      This is done when the ebeanServer is shutdown manually.