Class AbandonedConnectionCleanupThread

java.lang.Object
com.mysql.cj.jdbc.AbandonedConnectionCleanupThread
All Implemented Interfaces:
java.lang.Runnable

public class AbandonedConnectionCleanupThread
extends java.lang.Object
implements java.lang.Runnable
This class implements a thread that is responsible for closing abandoned MySQL connections, i.e., connections that are not explicitly closed. There is only one instance of this class and there is a single thread to do this task. This thread's executor is statically referenced in this same class.
  • Method Summary

    Modifier and Type Method Description
    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.
    static boolean isAlive()
    Returns true if the working thread is alive.
    void run()  
    protected static void trackConnection​(MysqlConnection conn, NetworkResources io)
    Tracks the finalization of a MysqlConnection object and keeps a reference to its NetworkResources so that they can be later released.
    static void uncheckedShutdown()
    Performs an unchecked shutdown, i.e., the shutdown is performed independently of the context ClassLoaders from the involved threads.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • run

      public void run()
      Specified by:
      run in interface java.lang.Runnable
    • checkedShutdown

      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.
    • uncheckedShutdown

      public static void uncheckedShutdown()
      Performs an unchecked shutdown, i.e., the shutdown is performed independently of the context ClassLoaders from the involved threads.
    • isAlive

      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.
      Returns:
      true if the working thread is alive; false otherwise.
    • trackConnection

      protected static void trackConnection​(MysqlConnection conn, NetworkResources io)
      Tracks the finalization of a MysqlConnection object and keeps a reference to its NetworkResources so that they can be later released.
      Parameters:
      conn - the Connection object to track for finalization
      io - the network resources to close on the connection finalization