Class ConnectionPool.PoolCleaner

  • All Implemented Interfaces:
    java.lang.Runnable
    Enclosing class:
    ConnectionPool

    protected static class ConnectionPool.PoolCleaner
    extends java.util.TimerTask
    A scheduled task that periodically checks for abandoned connections, validates idle connections, and resizes the idle pool according to the pool's configuration.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.ref.WeakReference<ConnectionPool> pool
      Weak reference to the connection pool being monitored.
      protected long sleepTime
      Sleep interval in milliseconds between cleaner runs.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void run()  
      void start()
      Starts the pool cleaner by registering it with the shared timer.
      void stopRunning()
      Stops the pool cleaner by unregistering it from the shared timer.
      • Methods inherited from class java.util.TimerTask

        cancel, scheduledExecutionTime
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • pool

        protected java.lang.ref.WeakReference<ConnectionPool> pool
        Weak reference to the connection pool being monitored.
      • sleepTime

        protected long sleepTime
        Sleep interval in milliseconds between cleaner runs.
    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        Specified by:
        run in class java.util.TimerTask
      • start

        public void start()
        Starts the pool cleaner by registering it with the shared timer.
      • stopRunning

        public void stopRunning()
        Stops the pool cleaner by unregistering it from the shared timer.