Class OnExitDatabaseCloser
java.lang.Object
java.lang.Thread
org.h2.engine.OnExitDatabaseCloser
- All Implemented Interfaces:
Runnable
This class is responsible to close a database on JVM shutdown.
-
Nested Class Summary
Nested classes/interfaces inherited from class Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final WeakHashMap<Database, Void> private static final Threadprivate static booleanprivate static booleanFields inherited from class Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void(package private) static voidRegister database instance to close one on the JVM process shutdown.voidrun()(package private) static voidunregister(Database db) Unregister database instance.Methods inherited from class Thread
activeCount, checkAccess, clone, 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, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, toString, yield
-
Field Details
-
DATABASES
-
INSTANCE
-
registered
private static boolean registered -
terminated
private static boolean terminated
-
-
Constructor Details
-
OnExitDatabaseCloser
private OnExitDatabaseCloser()
-
-
Method Details
-
register
Register database instance to close one on the JVM process shutdown.- Parameters:
db- Database instance.
-
unregister
Unregister database instance.- Parameters:
db- Database instance.
-
onShutdown
private static void onShutdown() -
run
-