java.lang.Object
com.aoapps.sql.wrapper.StatementWrapperImpl
com.aoapps.sql.tracker.StatementTrackerImpl
- All Implemented Interfaces:
OnCloseHandler
,StatementTracker
,TrackedResultSets
,StatementWrapper
,Wrapper
,AutoCloseable
,Statement
,Wrapper
Tracks a
Statement
for unclosed or unfreed objects.- Author:
- AO Industries, Inc.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Level
The logging level that enables allocation stack trace logging.Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
-
Constructor Summary
ConstructorDescriptionStatementTrackerImpl
(ConnectionTrackerImpl connectionTracker, Statement wrapped) Creates a newStatement
tracker. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addOnClose
(Runnable onCloseHandler) Will call the handler once on close/free.void
close()
Calls onClose handlers, closes all tracked objects, then callssuper.close()
.final Map
<ResultSet, ResultSetTrackerImpl> Gets all the result sets that have not yet been closed.protected ResultSetTrackerImpl
wrapResultSet
(ResultSet results) Methods inherited from class com.aoapps.sql.wrapper.StatementWrapperImpl
executeQuery, getConnection, getConnectionWrapper, getGeneratedKeys, getResultSet, getWrapped, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.sql.Statement
enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, isSimpleIdentifier
Methods inherited from interface com.aoapps.sql.wrapper.StatementWrapper
addBatch, cancel, clearBatch, clearWarnings, closeOnCompletion, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, getWrapped, isClosed, isCloseOnCompletion, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
Methods inherited from interface com.aoapps.sql.wrapper.Wrapper
isWrapperFor, unwrap
-
Field Details
-
ALLOCATION_STACKTRACE_LOG_LEVEL
The logging level that enables allocation stack trace logging.
-
-
Constructor Details
-
StatementTrackerImpl
Creates a newStatement
tracker.
-
-
Method Details
-
getAllocationStacktrace
-
getAllocationLogger
-
addOnClose
Description copied from interface:OnCloseHandler
Will call the handler once on close/free.- Specified by:
addOnClose
in interfaceOnCloseHandler
-
getTrackedResultSets
Description copied from interface:TrackedResultSets
Gets all the result sets that have not yet been closed.- Specified by:
getTrackedResultSets
in interfaceTrackedResultSets
- Returns:
- The mapping from wrapped result set to tracker without any defensive copy.
- See Also:
-
wrapResultSet
- Overrides:
wrapResultSet
in classStatementWrapperImpl
- Throws:
SQLException
-
close
Calls onClose handlers, closes all tracked objects, then callssuper.close()
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceStatement
- Specified by:
close
in interfaceStatementTracker
- Specified by:
close
in interfaceStatementWrapper
- Throws:
SQLException
- See Also:
-