Class PgConnectionCleaningAction

  • All Implemented Interfaces:
    LazyCleaner.CleaningAction<java.io.IOException>

    class PgConnectionCleaningAction
    extends java.lang.Object
    implements LazyCleaner.CleaningAction<java.io.IOException>
    This class segregates the minimal resources required for proper cleanup in case the connection has not been closed by the user code.

    For now, it has two actions:

    • Print stacktrace when the connection has been created, so users can identify the leak
    • Release shared timer registration
    • Field Detail

      • LOGGER

        private static final java.util.logging.Logger LOGGER
      • openStackTrace

        private java.lang.Throwable openStackTrace
      • queryExecutorCloseAction

        private final java.io.Closeable queryExecutorCloseAction
      • cancelTimer

        private java.util.Timer cancelTimer
        Timer for scheduling TimerTasks for the connection. Only instantiated if a task is actually scheduled. Access should be guarded with lock
    • Constructor Detail

      • PgConnectionCleaningAction

        PgConnectionCleaningAction​(ResourceLock lock,
                                   java.lang.Throwable openStackTrace,
                                   java.io.Closeable queryExecutorCloseAction)
    • Method Detail

      • getTimer

        public java.util.Timer getTimer()
      • releaseTimer

        public void releaseTimer()
      • purgeTimerTasks

        public void purgeTimerTasks()
      • onClean

        public void onClean​(boolean leak)
                     throws java.io.IOException
        Specified by:
        onClean in interface LazyCleaner.CleaningAction<java.io.IOException>
        Throws:
        java.io.IOException