Package org.eclipse.jetty.util.thread
Class ShutdownThread
java.lang.Object
java.lang.Thread
org.eclipse.jetty.util.thread.ShutdownThread
- All Implemented Interfaces:
Runnable
ShutdownThread is a shutdown hook thread implemented as
singleton that maintains a list of lifecycle instances
that are registered with it and provides ability to stop
these lifecycles upon shutdown of the Java Virtual Machine
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private static final ShutdownThread
private static final Logger
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Default constructor for the singleton Registers the instance as shutdown hook with the Java Runtime -
Method Summary
Modifier and TypeMethodDescriptionstatic void
deregister
(LifeCycle lifeCycle) static ShutdownThread
Returns the instance of the singletonprivate void
hook()
static boolean
isRegistered
(LifeCycle lifeCycle) static void
static void
void
run()
private void
unhook()
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
LOG
-
_thread
-
_hooked
private boolean _hooked -
_lifeCycles
-
-
Constructor Details
-
ShutdownThread
private ShutdownThread()Default constructor for the singleton Registers the instance as shutdown hook with the Java Runtime
-
-
Method Details
-
hook
private void hook() -
unhook
private void unhook() -
getInstance
Returns the instance of the singleton- Returns:
- the singleton instance of the
ShutdownThread
-
register
-
register
-
deregister
-
isRegistered
-
run
public void run()
-