| Modifier and Type | Class and Description |
|---|---|
| private static class | AbandonedConnectionCleanupThread.
|
| Modifier and Type | Field and Description |
|---|---|
| private static boolean | |
| private static final ExecutorService | |
| private static final Set | |
| private static final ReferenceQueue | |
| private static Thread | |
| private static Lock |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static void | checkedShutdown()
Performs a checked shutdown, i.e., the context ClassLoaders from this and the caller thread are checked for consistency prior to performing the shutdown operation. |
| private void | |
| private static boolean | Returns: true if both threads share the same context ClassLoader, false otherwiseChecks if the context ClassLoaders from this and the caller thread are the same. |
| private static void | finalizeResource(AbandonedConnectionCleanupThread.
the referenceConnectionFinalizerPhantomReference to finalize.Release resources from the given |
| public static boolean | Returns: true if the working thread is alive; false otherwise.Returns true if the working thread is alive. |
| public void | |
| private static void | shutdown(boolean
does a checked shutdown if true, unchecked otherwise checked)Shuts down this thread either checking or not the context ClassLoaders from the involved threads. |
| protected static void | trackConnection(MysqlConnection
the Connection object to track for finalization conn, NetworkResources the network resources to close on the connection finalization io)Tracks the finalization of a |
| public static void | uncheckedShutdown()
Performs an unchecked shutdown, i.e., the shutdown is performed independently of the context ClassLoaders from the involved threads. |
| abandonedConnectionCleanupDisabled | back to summary |
|---|---|
| private static boolean abandonedConnectionCleanupDisabled | |
| cleanupThreadExecutorService | back to summary |
|---|---|
| private static final ExecutorService cleanupThreadExecutorService | |
| connectionFinalizerPhantomRefs | back to summary |
|---|---|
| private static final Set<AbandonedConnectionCleanupThread. | |
| referenceQueue | back to summary |
|---|---|
| private static final ReferenceQueue<MysqlConnection> referenceQueue | |
| threadRef | back to summary |
|---|---|
| private static Thread threadRef | |
| threadRefLock | back to summary |
|---|---|
| private static Lock threadRefLock | |
| AbandonedConnectionCleanupThread | back to summary |
|---|---|
| private AbandonedConnectionCleanupThread() | |
| checkedShutdown | back to summary |
|---|---|
| public static void checkedShutdown() Performs a checked shutdown, i.e., the context ClassLoaders from this and the caller thread are checked for consistency prior to performing the shutdown operation. | |
| checkThreadContextClassLoader | back to summary |
|---|---|
| private void checkThreadContextClassLoader() Checks if the thread's context ClassLoader is active. This is usually true but some application managers implement a life-cycle mechanism in their ClassLoaders that is linked to the corresponding application's life-cycle. As such, a stopped/ended application will have a ClassLoader unable to load anything and, eventually, they throw an exception when trying to do so. When this happens, this thread has no point in being alive anymore. | |
| consistentClassLoaders | back to summary |
|---|---|
| private static boolean consistentClassLoaders() Checks if the context ClassLoaders from this and the caller thread are the same.
| |
| finalizeResource | back to summary |
|---|---|
| private static void finalizeResource(AbandonedConnectionCleanupThread. Release resources from the given
| |
| isAlive | back to summary |
|---|---|
| public static boolean isAlive() Returns true if the working thread is alive. It is alive if it was initialized successfully and wasn't shutdown yet.
| |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |
| shutdown | back to summary |
|---|---|
| private static void shutdown(boolean checked) Shuts down this thread either checking or not the context ClassLoaders from the involved threads.
| |
| trackConnection | back to summary |
|---|---|
| protected static void trackConnection(MysqlConnection conn, NetworkResources io) Tracks the finalization of a
| |
| uncheckedShutdown | back to summary |
|---|---|
| public static void uncheckedShutdown() Performs an unchecked shutdown, i.e., the shutdown is performed independently of the context ClassLoaders from the involved threads. | |
PhantomReference subclass to track MysqlConnection objects finalization.
This class holds a reference to the Connection's NetworkResources so they it can be later closed.
| Modifier and Type | Field and Description |
|---|---|
| private NetworkResources |
| Access | Constructor and Description |
|---|---|
| pack-priv | ConnectionFinalizerPhantomReference(MysqlConnection conn, NetworkResources networkResources, ReferenceQueue<? super MysqlConnection> refQueue)
|
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void |
| networkResources | back to summary |
|---|---|
| private NetworkResources networkResources | |
| ConnectionFinalizerPhantomReference | back to summary |
|---|---|
| pack-priv ConnectionFinalizerPhantomReference(MysqlConnection conn, NetworkResources networkResources, ReferenceQueue<? super MysqlConnection> refQueue) | |
| finalizeResources | back to summary |
|---|---|
| pack-priv void finalizeResources() | |