Package org.apache.axis2.util
Class GracefulShutdownTimer
java.lang.Object
java.util.TimerTask
org.apache.axis2.util.GracefulShutdownTimer
- All Implemented Interfaces:
Runnable
Singleton timer class for managing graceful shutdown operations.
Allows starting a shutdown countdown, checking its status, and querying remaining time.
-
Method Summary
Modifier and TypeMethodDescriptionstatic GracefulShutdownTimerlongReturns the remaining time in milliseconds until shutdown.longbooleanChecks if the shutdown timer has expired.booleanChecks if the shutdown timer has been started.voidrun()Marks the timer as expired when the scheduled time elapses.voidstart(long shutdownTimeoutMillis) Starts the graceful shutdown timer with the specified timeout.Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
Method Details
-
getInstance
-
run
public void run()Marks the timer as expired when the scheduled time elapses. This method is called by the Timer framework. -
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
-