org.springframework.boot.web.context

Class WebServerGracefulShutdownLifecycle

  • java.lang.Object
    • org.springframework.boot.web.context.WebServerGracefulShutdownLifecycle
  • All Implemented Interfaces:
    org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle


    public final class WebServerGracefulShutdownLifecycle
    extends java.lang.Object
    implements org.springframework.context.SmartLifecycle
    SmartLifecycle to trigger WebServer graceful shutdown.
    Since:
    2.5.0
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int SMART_LIFECYCLE_PHASE
      SmartLifecycle phase in which graceful shutdown of the web server is performed.
      • Fields inherited from interface org.springframework.context.SmartLifecycle

        DEFAULT_PHASE
    • Constructor Summary

      Constructors 
      Constructor and Description
      WebServerGracefulShutdownLifecycle(WebServer webServer)
      Creates a new WebServerGracefulShutdownLifecycle that will gracefully shut down the given webServer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int getPhase() 
      boolean isRunning() 
      void start() 
      void stop() 
      void stop(java.lang.Runnable callback) 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.springframework.context.SmartLifecycle

        isAutoStartup
    • Field Detail

      • SMART_LIFECYCLE_PHASE

        public static final int SMART_LIFECYCLE_PHASE
        SmartLifecycle phase in which graceful shutdown of the web server is performed.
        See Also:
        Constant Field Values
    • Constructor Detail

      • WebServerGracefulShutdownLifecycle

        public WebServerGracefulShutdownLifecycle(WebServer webServer)
        Creates a new WebServerGracefulShutdownLifecycle that will gracefully shut down the given webServer.
        Parameters:
        webServer - web server to shut down gracefully
    • Method Detail

      • start

        public void start()
        Specified by:
        start in interface org.springframework.context.Lifecycle
      • stop

        public void stop()
        Specified by:
        stop in interface org.springframework.context.Lifecycle
      • stop

        public void stop(java.lang.Runnable callback)
        Specified by:
        stop in interface org.springframework.context.SmartLifecycle
      • isRunning

        public boolean isRunning()
        Specified by:
        isRunning in interface org.springframework.context.Lifecycle
      • getPhase

        public int getPhase()
        Specified by:
        getPhase in interface org.springframework.context.Phased
        Specified by:
        getPhase in interface org.springframework.context.SmartLifecycle