Package org.digidoc4j
Class ShutdownHook
java.lang.Object
java.lang.Thread
org.digidoc4j.ShutdownHook
- All Implemented Interfaces:
Runnable
Shutdown hook for a clean shutdown
There's a good chance that some non-daemon threads handled by some sort of
and call
NB! As the usage method of this hook is dependant on the system/situation and may vary,
so in consequence it's still in experimental status
Created by Janar Rahumeel (CGI Estonia)
ExecutorService
are preventing JVM from a clean shutdown.
How to use it exactly depends on the situation.
For example when dealing a simple Java "main" program, which has only a single context then
registering this hook by Runtime.addShutdownHook(Thread)
should be sufficient.
In case of some sort of webapp in a servlet container where there are multiple levels of contexts
the recommended way to use it is to register a
invalid reference
jakarta.servlet.ServletContextListener
run()
method inside
invalid reference
jakarta.servlet.ServletContextListener#contextDestroyed(ServletContextEvent)
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Thread
activeCount, checkAccess, 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