| 
Apache Tomcat 7.0.28 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.tomcat.jdbc.pool.JdbcInterceptor
org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor
org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport
public abstract class AbstractQueryReport
Abstract class that wraps statements and intercepts query executions.
| Nested Class Summary | |
|---|---|
protected  class | 
AbstractQueryReport.StatementProxy
Class to measure query execute time  | 
| Field Summary | |
|---|---|
protected static Constructor<?>[] | 
constructors
the constructors that are used to create statement proxies  | 
protected  long | 
threshold
The threshold in milliseconds.  | 
| Fields inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor | 
|---|
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, GETCONNECTION_VAL, ISCLOSED_VAL, ISVALID_VAL, ISWRAPPERFOR_VAL, properties, TOSTRING_VAL, UNWRAP_VAL | 
| Constructor Summary | |
|---|---|
AbstractQueryReport()
 | 
|
| Method Summary | |
|---|---|
 Object | 
createStatement(Object proxy,
                Method method,
                Object[] args,
                Object statement,
                long time)
Creates a statement interceptor to monitor query response times  | 
protected  Constructor<?> | 
getConstructor(int idx,
               Class<?> clazz)
Creates a constructor for a proxy class, if one doesn't already exist  | 
 long | 
getThreshold()
returns the query measure threshold.  | 
protected abstract  void | 
prepareCall(String query,
            long time)
Invoked when prepareCall has been called and completed.  | 
protected abstract  void | 
prepareStatement(String sql,
                 long time)
Invoked when prepareStatement has been called and completed.  | 
protected  String | 
reportFailedQuery(String query,
                  Object[] args,
                  String name,
                  long start,
                  Throwable t)
Invoked when a query execution, a call to execute/executeQuery or executeBatch failed.  | 
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 threshold  | 
protected  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 threshold  | 
 void | 
setThreshold(long threshold)
Sets the query measurement threshold.  | 
| Methods inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor | 
|---|
closeInvoked, invoke, isExecute, isStatement, process, reset | 
| Methods inherited from class org.apache.tomcat.jdbc.pool.JdbcInterceptor | 
|---|
compare, compare, disconnected, getNext, getProperties, isUseEquals, poolClosed, poolStarted, setNext, setProperties, setUseEquals | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected long threshold
protected static final Constructor<?>[] constructors
| Constructor Detail | 
|---|
public AbstractQueryReport()
| Method Detail | 
|---|
protected abstract void prepareStatement(String sql,
                                         long time)
sql - - the string used to prepare the statement withtime - - the time it took to invoke prepare
protected abstract void prepareCall(String query,
                                    long time)
query - - the string used to prepare the statement withtime - - the time it took to invoke prepare
protected String reportFailedQuery(String query,
                                   Object[] args,
                                   String name,
                                   long start,
                                   Throwable t)
query - the query that was executed and failedargs - the arguments to the executionname - the name of the method used to execute AbstractCreateStatementInterceptor.isExecute(Method, boolean)start - the time the query execution startedt - the exception that happened
protected String reportQuery(String query,
                             Object[] args,
                             String name,
                             long start,
                             long delta)
query - the query that was executed and failedargs - the arguments to the executionname - the name of the method used to execute AbstractCreateStatementInterceptor.isExecute(Method, boolean)start - the time the query execution starteddelta - the time the execution took
protected String reportSlowQuery(String query,
                                 Object[] args,
                                 String name,
                                 long start,
                                 long delta)
query - the query that was executed and failedargs - the arguments to the executionname - the name of the method used to execute AbstractCreateStatementInterceptor.isExecute(Method, boolean)start - the time the query execution starteddelta - the time the execution took
public long getThreshold()
public void setThreshold(long threshold)
threshold - set to -1 to record every query. Value is in milliseconds.
protected Constructor<?> getConstructor(int idx,
                                        Class<?> clazz)
                                 throws NoSuchMethodException
idx - - the index of the constructorclazz - - the interface that the proxy will implement
NoSuchMethodException
public Object createStatement(Object proxy,
                              Method method,
                              Object[] args,
                              Object statement,
                              long time)
createStatement in class AbstractCreateStatementInterceptorproxy - the actual proxy objectmethod - the method that was called. It will be one of the methods defined in AbstractCreateStatementInterceptor.STATEMENT_TYPESargs - the arguments to the methodstatement - the statement that the underlying connection created
Statement object
  | 
Apache Tomcat 7.0.28 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||