Package org.postgresql.jdbc
Class PgConnectionCleaningAction
java.lang.Object
org.postgresql.jdbc.PgConnectionCleaningAction
- All Implemented Interfaces:
LazyCleaner.CleaningAction<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 Summary
FieldsModifier and TypeFieldDescriptionprivate Timer
Timer for scheduling TimerTasks for the connection.private final ResourceLock
private static final Logger
private Throwable
private final Closeable
-
Constructor Summary
ConstructorsConstructorDescriptionPgConnectionCleaningAction
(ResourceLock lock, Throwable openStackTrace, Closeable queryExecutorCloseAction) -
Method Summary
-
Field Details
-
LOGGER
-
lock
-
openStackTrace
-
queryExecutorCloseAction
-
cancelTimer
Timer for scheduling TimerTasks for the connection. Only instantiated if a task is actually scheduled. Access should be guarded withlock
-
-
Constructor Details
-
PgConnectionCleaningAction
PgConnectionCleaningAction(ResourceLock lock, Throwable openStackTrace, Closeable queryExecutorCloseAction)
-
-
Method Details
-
getTimer
-
releaseTimer
public void releaseTimer() -
purgeTimerTasks
public void purgeTimerTasks() -
onClean
- Specified by:
onClean
in interfaceLazyCleaner.CleaningAction<IOException>
- Throws:
IOException
-