org.springframework.boot

Interface SpringApplicationShutdownHandlers



  • public interface SpringApplicationShutdownHandlers
    Interface that can be used to add or remove code that should run when the JVM is shutdown. Shutdown handers are similar to JVM shutdown hooks except that they run sequentially rather than concurrently.

    Shutdown handlers are guaranteed to be called only after registered ApplicationContext instances have been closed and are no longer active.

    Since:
    2.5.1
    See Also:
    SpringApplication.getShutdownHandlers(), SpringApplication.setRegisterShutdownHook(boolean)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      void add(java.lang.Runnable action)
      Add an action to the handlers that will be run when the JVM exits.
      void remove(java.lang.Runnable action)
      Remove a previously added an action so that it no longer runs when the JVM exits.
    • Method Detail

      • add

        void add(java.lang.Runnable action)
        Add an action to the handlers that will be run when the JVM exits.
        Parameters:
        action - the action to add
      • remove

        void remove(java.lang.Runnable action)
        Remove a previously added an action so that it no longer runs when the JVM exits.
        Parameters:
        action - the action to remove