Top Description Fields Constructors Methods
org.eclipse.jetty.util.thread

public Class ShutdownThread

extends Thread
Class Inheritance
Imports
java.util.Arrays, .List, java.util.concurrent.CopyOnWriteArrayList, org.eclipse.jetty.util.component.Destroyable, .LifeCycle, org.slf4j.Logger, .LoggerFactory

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

Field Summary

Modifier and TypeField and Description
private boolean
private final List<LifeCycle>
private final AutoLock
private static final ShutdownThread
private static final Logger
Inherited from java.lang.Thread:
MAX_PRIORITYMIN_PRIORITYNORM_PRIORITY

Constructor Summary

AccessConstructor and Description
private
ShutdownThread()

Default constructor for the singleton Registers the instance as shutdown hook with the Java Runtime

Method Summary

Modifier and TypeMethod and Description
public static void
deregister(LifeCycle lifeCycle)

public static ShutdownThread

Returns:

the singleton instance of the ShutdownThread
getInstance
()

Returns the instance of the singleton

private void
hook()

public static boolean
public static void
register(LifeCycle... lifeCycles)

public static void
register(int index, LifeCycle... lifeCycles)

public void
run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

This method is run by the thread when it executes.
private void
Inherited from java.lang.Thread:
activeCountcheckAccessclonecountStackFramescurrentThreaddumpStackenumerategetAllStackTracesgetContextClassLoadergetDefaultUncaughtExceptionHandlergetIdgetNamegetPrioritygetStackTracegetStategetThreadGroupgetUncaughtExceptionHandlerholdsLockinterruptinterruptedisAliveisDaemonisInterruptedisVirtualjoinjoinjoinjoinofPlatformofVirtualonSpinWaitresumesetContextClassLoadersetDaemonsetDefaultUncaughtExceptionHandlersetNamesetPrioritysetUncaughtExceptionHandlersleepsleepsleepstartstartVirtualThreadstopsuspendthreadIdtoStringyield

Field Detail

_hookedback to summary
private boolean _hooked
_lifeCyclesback to summary
private final List<LifeCycle> _lifeCycles
_lockback to summary
private final AutoLock _lock
_threadback to summary
private static final ShutdownThread _thread
LOGback to summary
private static final Logger LOG

Constructor Detail

ShutdownThreadback to summary
private ShutdownThread()

Default constructor for the singleton Registers the instance as shutdown hook with the Java Runtime

Method Detail

deregisterback to summary
public static void deregister(LifeCycle lifeCycle)
getInstanceback to summary
public static ShutdownThread getInstance()

Returns the instance of the singleton

Returns:ShutdownThread

the singleton instance of the ShutdownThread

hookback to summary
private void hook()
isRegisteredback to summary
public static boolean isRegistered(LifeCycle lifeCycle)
registerback to summary
public static void register(LifeCycle... lifeCycles)
registerback to summary
public static void register(int index, LifeCycle... lifeCycles)
runback to summary
public void run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

Doc from java.lang.Thread.run.

This method is run by the thread when it executes. Subclasses of Thread may override this method.

This method is not intended to be invoked directly. If this thread is a platform thread created with a Runnable task then invoking this method will invoke the task's run method. If this thread is a virtual thread then invoking this method directly does nothing.

Annotations
@Override
unhookback to summary
private void unhook()