Top Description Fields Constructors Methods
org.apache.tomcat.jdbc.pool.interceptor

public Class ResetAbandonedTimer

extends AbstractQueryReport
implements ResetAbandonedTimerMBean
Class Inheritance
All Implemented Interfaces
org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimerMBean
Imports
java.lang.reflect.Method, javax.management.ObjectName, org.apache.tomcat.jdbc.pool.ConnectionPool, .PooledConnection, org.apache.tomcat.jdbc.pool.jmx.JmxUtil

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 org.apache.tomcat.jdbc.pool.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.

Field Summary

Modifier and TypeField and Description
private ObjectName
private PooledConnection
Inherited from org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport:
threshold

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public Object
invoke(Object
the proxy instance that the method was invoked on
proxy
,
Method
the Method instance corresponding to the interface method invoked on the proxy instance. The declaring class of the Method object will be the interface that the method was declared in, which may be a superinterface of the proxy interface that the proxy class inherits the method through.
method
,
Object[]
an array of objects containing the values of the arguments passed in the method invocation on the proxy instance, or null if interface method takes no arguments. Arguments of primitive types are wrapped in instances of the appropriate primitive wrapper class, such as java.lang.Integer or java.lang.Boolean.
args
)

Overrides org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke.

Implements java.lang.reflect.InvocationHandler.invoke.

Gets invoked each time an operation on java.sql.Connection is invoked.

protected void
prepareCall(String
- the string used to prepare the statement with
query
,
long
- the time it took to invoke prepare
time
)

Implements abstract org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport.prepareCall.

Invoked when prepareCall has been called and completed.

protected void
prepareStatement(String
- the string used to prepare the statement with
sql
,
long
- the time it took to invoke prepare
time
)

Implements abstract org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport.prepareStatement.

Invoked when prepareStatement has been called and completed.

protected String
reportQuery(String
the query that was executed and failed
query
,
Object[]
the arguments to the execution
args
,
String name, long
the time the query execution started
start
,
long
the time the execution took
delta
)

Overrides org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport.reportQuery.

Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was within the timing threshold

protected String
reportSlowQuery(String
the query that was executed and failed
query
,
Object[]
the arguments to the execution
args
,
String name, long
the time the query execution started
start
,
long
the time the execution took
delta
)

Overrides org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport.reportSlowQuery.

Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was exceeded the timing threshold

public void
reset(ConnectionPool
- the connection pool owning the connection
parent
,
PooledConnection
- the pooled connection
con
)

Overrides org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.reset.

no-op for this interceptor.

public boolean
Inherited from org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport:
createStatementgetThresholdreportFailedQuerysetThreshold

Field Detail

onameback to summary
private ObjectName oname
pconback to summary
private PooledConnection pcon

Constructor Detail

ResetAbandonedTimerback to summary
public ResetAbandonedTimer()

Method Detail

closeInvokedback to summary
public void closeInvoked()

Implements abstract org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.closeInvoked.

Doc from org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.closeInvoked.

Method invoked when the operation java.sql.Connection#close() is invoked.

Annotations
@Override
invokeback to summary
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable

Overrides org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.invoke.

Implements java.lang.reflect.InvocationHandler.invoke.

Doc from org.apache.tomcat.jdbc.pool.JdbcInterceptor.invoke.

Gets invoked each time an operation on java.sql.Connection is invoked. Processes a method invocation on a proxy instance and returns the result. This method will be invoked on an invocation handler when a method is invoked on a proxy instance that it is associated with.

Parameters
proxy:Object

Doc from java.lang.reflect.InvocationHandler.invoke.

the proxy instance that the method was invoked on

method:Method

Doc from java.lang.reflect.InvocationHandler.invoke.

the Method instance corresponding to the interface method invoked on the proxy instance. The declaring class of the Method object will be the interface that the method was declared in, which may be a superinterface of the proxy interface that the proxy class inherits the method through.

args:Object[]

Doc from java.lang.reflect.InvocationHandler.invoke.

an array of objects containing the values of the arguments passed in the method invocation on the proxy instance, or null if interface method takes no arguments. Arguments of primitive types are wrapped in instances of the appropriate primitive wrapper class, such as java.lang.Integer or java.lang.Boolean.

Returns:Object

Doc from java.lang.reflect.InvocationHandler.invoke.

the value to return from the method invocation on the proxy instance. If the declared return type of the interface method is a primitive type, then the value returned by this method must be an instance of the corresponding primitive wrapper class; otherwise, it must be a type assignable to the declared return type. If the value returned by this method is null and the interface method's return type is primitive, then a NullPointerException will be thrown by the method invocation on the proxy instance. If the value returned by this method is otherwise not compatible with the interface method's declared return type as described above, a ClassCastException will be thrown by the method invocation on the proxy instance.

Annotations
@Override
Exceptions
Throwable:

Doc from java.lang.reflect.InvocationHandler.invoke.

the exception to throw from the method invocation on the proxy instance. The exception's type must be assignable either to any of the exception types declared in the throws clause of the interface method or to the unchecked exception types java.lang.RuntimeException or java.lang.Error. If a checked exception is thrown by this method that is not assignable to any of the exception types declared in the throws clause of the interface method, then an UndeclaredThrowableException containing the exception that was thrown by this method will be thrown by the method invocation on the proxy instance.

prepareCallback to summary
protected void prepareCall(String query, long time)

Implements abstract org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport.prepareCall.

Doc from org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport.prepareCall.

Invoked when prepareCall has been called and completed.

Parameters
query:String

- the string used to prepare the statement with

time:long

- the time it took to invoke prepare

Annotations
@Override
prepareStatementback to summary
protected void prepareStatement(String sql, long time)

Implements abstract org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport.prepareStatement.

Doc from org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport.prepareStatement.

Invoked when prepareStatement has been called and completed.

Parameters
sql:String

- the string used to prepare the statement with

time:long

- the time it took to invoke prepare

Annotations
@Override
reportQueryback to summary
protected String reportQuery(String query, Object[] args, String name, long start, long delta)

Overrides org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport.reportQuery.

Doc from org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport.reportQuery.

Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was within the timing threshold

Parameters
query:String

the query that was executed and failed

args:Object[]

the arguments to the execution

name:String

the name of the method used to execute AbstractCreateStatementInterceptor#isExecute(Method, boolean)

start:long

the time the query execution started

delta:long

the time the execution took

Returns:String

- the SQL that was executed or the string "batch" if it was a batch execution

Annotations
@Override
reportSlowQueryback to summary
protected String reportSlowQuery(String query, Object[] args, String name, long start, long delta)

Overrides org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport.reportSlowQuery.

Doc from org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport.reportSlowQuery.

Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was exceeded the timing threshold

Parameters
query:String

the query that was executed and failed

args:Object[]

the arguments to the execution

name:String

the name of the method used to execute AbstractCreateStatementInterceptor#isExecute(Method, boolean)

start:long

the time the query execution started

delta:long

the time the execution took

Returns:String

- the SQL that was executed or the string "batch" if it was a batch execution

Annotations
@Override
resetback to summary
public void reset(ConnectionPool parent, PooledConnection con)

Overrides org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.reset.

Doc from org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor.reset.

no-op for this interceptor. no state is stored.

Parameters
parent:ConnectionPool

Doc from org.apache.tomcat.jdbc.pool.JdbcInterceptor.reset.

- the connection pool owning the connection

con:PooledConnection

Doc from org.apache.tomcat.jdbc.pool.JdbcInterceptor.reset.

- the pooled connection

Annotations
@Override
resetTimerback to summary
public boolean resetTimer()

Implements org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimerMBean.resetTimer.

Annotations
@Override