Package org.h2.engine
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 java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final WeakHashMap
<Database, Void> private static final Thread
private static boolean
private static boolean
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
(package private) static void
Register database instance to close one on the JVM process shutdown.void
run()
(package private) static void
unregister
(Database db) Unregister database instance.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
-
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
public void run()
-