Class AbstractQueryReport
- java.lang.Object
- 
- org.apache.tomcat.jdbc.pool.JdbcInterceptor
- 
- org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor
- 
- org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport
 
 
 
- 
- All Implemented Interfaces:
- java.lang.reflect.InvocationHandler
 - Direct Known Subclasses:
- ResetAbandonedTimer,- SlowQueryReport
 
 public abstract class AbstractQueryReport extends AbstractCreateStatementInterceptor Abstract class that wraps statements and intercepts query executions.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected classAbstractQueryReport.StatementProxyClass to measure query execute time
 - 
Field SummaryFields Modifier and Type Field Description protected longthresholdThe threshold in milliseconds.- 
Fields inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptorconstructors, 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.JdbcInterceptorCLOSE_VAL, EQUALS_VAL, GETCONNECTION_VAL, HASHCODE_VAL, ISCLOSED_VAL, ISVALID_VAL, ISWRAPPERFOR_VAL, properties, TOSTRING_VAL, UNWRAP_VAL
 
- 
 - 
Constructor SummaryConstructors Constructor Description AbstractQueryReport()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectcreateStatement(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object statement, long time)Creates a statement interceptor to monitor query response timeslonggetThreshold()returns the query measure threshold.protected abstract voidprepareCall(java.lang.String query, long time)Invoked when prepareCall has been called and completed.protected abstract voidprepareStatement(java.lang.String sql, long time)Invoked when prepareStatement has been called and completed.protected java.lang.StringreportFailedQuery(java.lang.String query, java.lang.Object[] args, java.lang.String name, long start, java.lang.Throwable t)Invoked when a query execution, a call to execute/executeQuery or executeBatch failed.protected java.lang.StringreportQuery(java.lang.String query, java.lang.Object[] args, java.lang.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 java.lang.StringreportSlowQuery(java.lang.String query, java.lang.Object[] args, java.lang.String name, long start, long delta)Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was exceeded the timing thresholdvoidsetThreshold(long threshold)Sets the query measurement threshold.- 
Methods inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptorcloseInvoked, getConstructor, invoke, isExecute, isStatement, process, reset
 - 
Methods inherited from class org.apache.tomcat.jdbc.pool.JdbcInterceptorcompare, compare, disconnected, getNext, getProperties, isUseEquals, poolClosed, poolStarted, setNext, setProperties, setUseEquals
 
- 
 
- 
- 
- 
Method Detail- 
prepareStatementprotected abstract void prepareStatement(java.lang.String sql, long time)Invoked when prepareStatement has been called and completed.- Parameters:
- sql- - the string used to prepare the statement with
- time- - the time it took to invoke prepare
 
 - 
prepareCallprotected abstract void prepareCall(java.lang.String query, long time)Invoked when prepareCall has been called and completed.- Parameters:
- query- - the string used to prepare the statement with
- time- - the time it took to invoke prepare
 
 - 
reportFailedQueryprotected java.lang.String reportFailedQuery(java.lang.String query, java.lang.Object[] args, java.lang.String name, long start, java.lang.Throwable t)Invoked when a query execution, a call to execute/executeQuery or executeBatch failed.- Parameters:
- query- the query that was executed and failed
- args- the arguments to the execution
- name- the name of the method used to execute- AbstractCreateStatementInterceptor.isExecute(Method, boolean)
- start- the time the query execution started
- t- the exception that happened
- Returns:
- - the SQL that was executed or the string "batch" if it was a batch execution
 
 - 
reportQueryprotected java.lang.String reportQuery(java.lang.String query, java.lang.Object[] args, java.lang.String name, long start, long delta)Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was within the timing threshold- Parameters:
- query- the query that was executed and failed
- args- the arguments to the execution
- name- the name of the method used to execute- AbstractCreateStatementInterceptor.isExecute(Method, boolean)
- start- the time the query execution started
- delta- the time the execution took
- Returns:
- - the SQL that was executed or the string "batch" if it was a batch execution
 
 - 
reportSlowQueryprotected java.lang.String reportSlowQuery(java.lang.String query, java.lang.Object[] args, java.lang.String name, long start, long delta)Invoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was exceeded the timing threshold- Parameters:
- query- the query that was executed and failed
- args- the arguments to the execution
- name- the name of the method used to execute- AbstractCreateStatementInterceptor.isExecute(Method, boolean)
- start- the time the query execution started
- delta- the time the execution took
- Returns:
- - the SQL that was executed or the string "batch" if it was a batch execution
 
 - 
getThresholdpublic long getThreshold() returns the query measure threshold. This value is in milliseconds. If the query is faster than this threshold than it won't be accounted for- Returns:
- the threshold in milliseconds
 
 - 
setThresholdpublic void setThreshold(long threshold) Sets the query measurement threshold. The value is in milliseconds. If the query goes faster than this threshold it will not be recorded.- Parameters:
- threshold- set to -1 to record every query. Value is in milliseconds.
 
 - 
createStatementpublic java.lang.Object createStatement(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object statement, long time)Creates a statement interceptor to monitor query response times- Specified by:
- createStatementin class- AbstractCreateStatementInterceptor
- Parameters:
- proxy- the actual proxy object
- method- the method that was called. It will be one of the methods defined in- AbstractCreateStatementInterceptor.STATEMENT_TYPES
- args- the arguments to the method
- statement- the statement that the underlying connection created
- time- Elapsed time
- Returns:
- a Statementobject
 
 
- 
 
-