java.lang.Object
com.aoapps.sql.wrapper.StatementWrapperImpl
com.aoapps.sql.wrapper.PreparedStatementWrapperImpl
com.aoapps.sql.tracker.PreparedStatementTrackerImpl
- All Implemented Interfaces:
OnCloseHandler
,PreparedStatementTracker
,StatementTracker
,TrackedParameterMetaDatas
,TrackedResultSetMetaDatas
,TrackedResultSets
,PreparedStatementWrapper
,StatementWrapper
,Wrapper
,AutoCloseable
,PreparedStatement
,Statement
,Wrapper
public class PreparedStatementTrackerImpl
extends PreparedStatementWrapperImpl
implements PreparedStatementTracker
Tracks a
PreparedStatement
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
ConstructorDescriptionPreparedStatementTrackerImpl
(ConnectionTrackerImpl connectionTracker, PreparedStatement wrapped) Creates a newPreparedStatement
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()
.Gets all the meta data that have not yet been closed.Gets all the meta data that have not yet been closed.final Map
<ResultSet, ResultSetTrackerImpl> Gets all the result sets that have not yet been closed.protected ParameterMetaDataTrackerImpl
wrapParameterMetaData
(ParameterMetaData metaData) protected ResultSetTrackerImpl
wrapResultSet
(ResultSet results) protected ResultSetMetaDataTrackerImpl
wrapResultSetMetaData
(ResultSetMetaData metaData) Methods inherited from class com.aoapps.sql.wrapper.PreparedStatementWrapperImpl
executeQuery, getMetaData, getParameterMetaData, getWrapped, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setRef, setRowId, setSQLXML, setUnicodeStream, unwrapArray, unwrapBlob, unwrapClob, unwrapInputStream, unwrapNClob, unwrapReader, unwrapRef, unwrapRowId, unwrapSQLXML
Methods inherited from class com.aoapps.sql.wrapper.StatementWrapperImpl
executeQuery, getConnection, getConnectionWrapper, getGeneratedKeys, getResultSet, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.aoapps.sql.wrapper.PreparedStatementWrapper
addBatch, clearParameters, execute, executeLargeUpdate, executeQuery, executeUpdate, getMetaData, getParameterMetaData, getWrapped, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setUnicodeStream, setURL
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, 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
-
PreparedStatementTrackerImpl
public PreparedStatementTrackerImpl(ConnectionTrackerImpl connectionTracker, PreparedStatement wrapped) Creates a newPreparedStatement
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:
-
getTrackedParameterMetaDatas
Description copied from interface:TrackedParameterMetaDatas
Gets all the meta data that have not yet been closed. Meta datas are assumed to be closed with their prepared statement.- Specified by:
getTrackedParameterMetaDatas
in interfaceTrackedParameterMetaDatas
- Returns:
- The mapping from wrapped meta data to tracker without any defensive copy.
- See Also:
-
getTrackedResultSetMetaDatas
Description copied from interface:TrackedResultSetMetaDatas
Gets all the meta data that have not yet been closed. Meta datas are assumed to be closed with their result set.- Specified by:
getTrackedResultSetMetaDatas
in interfaceTrackedResultSetMetaDatas
- Returns:
- The mapping from wrapped meta data to tracker without any defensive copy.
- See Also:
-
wrapResultSet
- Overrides:
wrapResultSet
in classStatementWrapperImpl
- Throws:
SQLException
-
wrapParameterMetaData
- Overrides:
wrapParameterMetaData
in classPreparedStatementWrapperImpl
-
wrapResultSetMetaData
- Overrides:
wrapResultSetMetaData
in classPreparedStatementWrapperImpl
-
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:
-