public abstract class AbstractQueryReport extends AbstractCreateStatementInterceptor
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractQueryReport.StatementProxy
Class to measure query execute time
|
Modifier and Type | Field and Description |
---|---|
protected long |
threshold
The threshold in milliseconds.
|
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
CLOSE_VAL, EQUALS_VAL, GETCONNECTION_VAL, HASHCODE_VAL, ISCLOSED_VAL, ISVALID_VAL, ISWRAPPERFOR_VAL, properties, TOSTRING_VAL, UNWRAP_VAL
Constructor and Description |
---|
AbstractQueryReport() |
Modifier and Type | Method and Description |
---|---|
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
|
long |
getThreshold()
returns the query measure threshold.
|
protected abstract void |
prepareCall(java.lang.String query,
long time)
Invoked when prepareCall has been called and completed.
|
protected abstract void |
prepareStatement(java.lang.String sql,
long time)
Invoked when prepareStatement has been called and completed.
|
protected 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.
|
protected 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
|
protected 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
|
void |
setThreshold(long threshold)
Sets the query measurement threshold.
|
closeInvoked, getConstructor, invoke, isExecute, isStatement, process, reset
compare, compare, disconnected, getNext, getProperties, isUseEquals, poolClosed, poolStarted, setNext, setProperties, setUseEquals
protected long threshold
protected abstract void prepareStatement(java.lang.String sql, long time)
sql
- - the string used to prepare the statement withtime
- - the time it took to invoke prepareprotected abstract void prepareCall(java.lang.String query, long time)
query
- - the string used to prepare the statement withtime
- - the time it took to invoke prepareprotected java.lang.String reportFailedQuery(java.lang.String query, java.lang.Object[] args, java.lang.String name, long start, java.lang.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 happenedprotected java.lang.String reportQuery(java.lang.String query, java.lang.Object[] args, java.lang.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 tookprotected java.lang.String reportSlowQuery(java.lang.String query, java.lang.Object[] args, java.lang.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 tookpublic long getThreshold()
public void setThreshold(long threshold)
threshold
- set to -1 to record every query. Value is in milliseconds.public java.lang.Object createStatement(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object statement, long time)
createStatement
in class AbstractCreateStatementInterceptor
proxy
- the actual proxy objectmethod
- the method that was called. It will be one of the methods defined in AbstractCreateStatementInterceptor.STATEMENT_TYPES
args
- the arguments to the methodstatement
- the statement that the underlying connection createdStatement
objectCopyright © 2000-2018 Apache Software Foundation. All Rights Reserved.