Class GracefulShutdownTimer

java.lang.Object
java.util.TimerTask
org.apache.axis2.util.GracefulShutdownTimer
All Implemented Interfaces:
Runnable

public class GracefulShutdownTimer extends TimerTask
Singleton timer class for managing graceful shutdown operations. Allows starting a shutdown countdown, checking its status, and querying remaining time.
  • Method Details

    • getInstance

      public static GracefulShutdownTimer getInstance()
    • run

      public void run()
      Marks the timer as expired when the scheduled time elapses. This method is called by the Timer framework.
      Specified by:
      run in interface Runnable
      Specified by:
      run in class TimerTask
    • start

      public void start(long shutdownTimeoutMillis)
      Starts the graceful shutdown timer with the specified timeout.
      Parameters:
      shutdownTimeoutMillis - the timeout in milliseconds before shutdown is considered expired
    • isStarted

      public boolean isStarted()
      Checks if the shutdown timer has been started.
      Returns:
      true if started, false otherwise
    • isExpired

      public boolean isExpired()
      Checks if the shutdown timer has expired.
      Returns:
      true if expired, false otherwise
    • getShutdownTimeoutMillis

      public long getShutdownTimeoutMillis()
    • getRemainingTimeMillis

      public long getRemainingTimeMillis()
      Returns the remaining time in milliseconds until shutdown. Returns 0 if the timer has already expired.
      Returns:
      remaining time in milliseconds, or 0 if expired