Class ResetAbandonedTimer
java.lang.Object
org.apache.tomcat.jdbc.pool.JdbcInterceptor
org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor
org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport
org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer
- All Implemented Interfaces:
InvocationHandler
,ResetAbandonedTimerMBean
Class that resets the abandoned timer on any activity on the
Connection or any successful query executions.
This interceptor is useful for when you have a
PoolConfiguration.setRemoveAbandonedTimeout(int)
that is fairly low, and you want to reset the abandoned time each time any operation on the connection is performed
This is useful for batch processing programs that use connections for extensive amount of times.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport
AbstractQueryReport.StatementProxy
-
Field Summary
Fields inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport
threshold
Fields inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor
constructors, CREATE_STATEMENT, CREATE_STATEMENT_IDX, EXECUTE, EXECUTE_BATCH, EXECUTE_QUERY, EXECUTE_TYPES, EXECUTE_UPDATE, PREPARE_CALL, PREPARE_CALL_IDX, PREPARE_STATEMENT, PREPARE_STATEMENT_IDX, STATEMENT_TYPE_COUNT, STATEMENT_TYPES
Fields inherited from class org.apache.tomcat.jdbc.pool.JdbcInterceptor
CLOSE_VAL, EQUALS_VAL, GETCONNECTION_VAL, HASHCODE_VAL, ISCLOSED_VAL, ISVALID_VAL, ISWRAPPERFOR_VAL, properties, TOSTRING_VAL, UNWRAP_VAL
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Method invoked when the operationConnection.close()
is invoked.Gets invoked each time an operation onConnection
is invoked.protected void
prepareCall
(String query, long time) Invoked when prepareCall has been called and completed.protected void
prepareStatement
(String sql, long time) Invoked when prepareStatement has been called and completed.protected String
reportQuery
(String query, Object[] args, String name, long start, long delta) Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was within the timing thresholdprotected String
reportSlowQuery
(String query, Object[] args, String name, long start, long delta) Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was exceeded the timing thresholdvoid
reset
(ConnectionPool parent, PooledConnection con) no-op for this interceptor. no state is stored.boolean
Methods inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport
createStatement, getThreshold, reportFailedQuery, setThreshold
Methods inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor
getConstructor, isExecute, isStatement, process
Methods inherited from class org.apache.tomcat.jdbc.pool.JdbcInterceptor
compare, compare, disconnected, getNext, getProperties, isUseEquals, poolClosed, poolStarted, setNext, setProperties, setUseEquals
-
Constructor Details
-
ResetAbandonedTimer
public ResetAbandonedTimer()
-
-
Method Details
-
reset
Description copied from class:AbstractCreateStatementInterceptor
no-op for this interceptor. no state is stored.- Overrides:
reset
in classAbstractCreateStatementInterceptor
- Parameters:
parent
- - the connection pool owning the connectioncon
- - the pooled connection
-
resetTimer
public boolean resetTimer()- Specified by:
resetTimer
in interfaceResetAbandonedTimerMBean
-
invoke
Description copied from class:JdbcInterceptor
Gets invoked each time an operation onConnection
is invoked.- Specified by:
invoke
in interfaceInvocationHandler
- Overrides:
invoke
in classAbstractCreateStatementInterceptor
- Throws:
Throwable
-
prepareCall
Description copied from class:AbstractQueryReport
Invoked when prepareCall has been called and completed.- Specified by:
prepareCall
in classAbstractQueryReport
- Parameters:
query
- - the string used to prepare the statement withtime
- - the time it took to invoke prepare
-
prepareStatement
Description copied from class:AbstractQueryReport
Invoked when prepareStatement has been called and completed.- Specified by:
prepareStatement
in classAbstractQueryReport
- Parameters:
sql
- - the string used to prepare the statement withtime
- - the time it took to invoke prepare
-
closeInvoked
public void closeInvoked()Description copied from class:AbstractCreateStatementInterceptor
Method invoked when the operationConnection.close()
is invoked.- Specified by:
closeInvoked
in classAbstractCreateStatementInterceptor
-
reportQuery
Description copied from class:AbstractQueryReport
Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was within the timing threshold- Overrides:
reportQuery
in classAbstractQueryReport
- Parameters:
query
- the query that was executed and failedargs
- the arguments to the executionname
- the name of the method used to executeAbstractCreateStatementInterceptor.isExecute(Method, boolean)
start
- the time the query execution starteddelta
- the time the execution took- Returns:
- - the SQL that was executed or the string "batch" if it was a batch execution
-
reportSlowQuery
Description copied from class:AbstractQueryReport
Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was exceeded the timing threshold- Overrides:
reportSlowQuery
in classAbstractQueryReport
- Parameters:
query
- the query that was executed and failedargs
- the arguments to the executionname
- the name of the method used to executeAbstractCreateStatementInterceptor.isExecute(Method, boolean)
start
- the time the query execution starteddelta
- the time the execution took- Returns:
- - the SQL that was executed or the string "batch" if it was a batch execution
-