Class AbandonedConnectionCleanupThread

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

public class AbandonedConnectionCleanupThread extends Object implements 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.
  • Field Details

    • threadRef

      static Thread threadRef
  • Method Details

    • run

      public void run()
      Specified by:
      run in interface 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
      invalid reference
      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
    • getThread

      public static Thread getThread()