|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.SlowQueryReport
public class SlowQueryReport
Slow query report interceptor. Tracks timing of query executions.
Nested Class Summary | |
---|---|
static class |
SlowQueryReport.QueryStats
|
Nested classes/interfaces inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport |
---|
AbstractQueryReport.StatementProxy |
Field Summary | |
---|---|
protected int |
maxQueries
Maximum number of queries we will be storing |
protected static ConcurrentHashMap<String,ConcurrentHashMap<String,SlowQueryReport.QueryStats>> |
perPoolStats
we will be keeping track of query stats on a per pool basis |
protected ConcurrentHashMap<String,SlowQueryReport.QueryStats> |
queries
the queries that are used for this interceptor. |
Fields inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport |
---|
constructors, threshold |
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 | |
---|---|
SlowQueryReport()
Creates a slow query report interceptor |
Method Summary | |
---|---|
void |
closeInvoked()
invoked when the connection receives the close request Not used for now. |
static ConcurrentHashMap<String,SlowQueryReport.QueryStats> |
getPoolStats(String poolname)
Returns the query stats for a given pool |
protected SlowQueryReport.QueryStats |
getQueryStats(String sql)
|
void |
poolClosed(ConnectionPool pool)
This method is invoked by a connection pool when the pool is closed. |
void |
poolStarted(ConnectionPool pool)
This method is invoked by a connection pool when the pool is first started up, usually when the first connection is requested. |
void |
prepareCall(String sql,
long time)
Invoked when prepareCall has been called and completed. |
void |
prepareStatement(String sql,
long time)
Invoked when prepareStatement has been called and completed. |
protected void |
removeOldest(ConcurrentHashMap<String,SlowQueryReport.QueryStats> queries)
TODO - implement a better algorithm |
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 |
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 |
reset(ConnectionPool parent,
PooledConnection con)
no-op for this interceptor. no state is stored. |
void |
setMaxQueries(int maxQueries)
|
void |
setProperties(Map<String,PoolProperties.InterceptorProperty> properties)
Called during the creation of an interceptor The properties can be set during the configuration of an interceptor Override this method to perform type casts between string values and object properties |
Methods inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReport |
---|
createStatement, getConstructor, getThreshold, reportQuery, setThreshold |
Methods inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptor |
---|
invoke, isExecute, isStatement, process |
Methods inherited from class org.apache.tomcat.jdbc.pool.JdbcInterceptor |
---|
compare, compare, disconnected, getNext, getProperties, isUseEquals, setNext, setUseEquals |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static ConcurrentHashMap<String,ConcurrentHashMap<String,SlowQueryReport.QueryStats>> perPoolStats
protected volatile ConcurrentHashMap<String,SlowQueryReport.QueryStats> queries
protected int maxQueries
Constructor Detail |
---|
public SlowQueryReport()
Method Detail |
---|
public static ConcurrentHashMap<String,SlowQueryReport.QueryStats> getPoolStats(String poolname)
poolname
- - the name of the pool we want to retrieve stats for
public void setMaxQueries(int maxQueries)
protected String reportFailedQuery(String query, Object[] args, String name, long start, Throwable t)
AbstractQueryReport
reportFailedQuery
in class AbstractQueryReport
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 reportSlowQuery(String query, Object[] args, String name, long start, long delta)
AbstractQueryReport
reportSlowQuery
in class AbstractQueryReport
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 void closeInvoked()
closeInvoked
in class AbstractCreateStatementInterceptor
public void prepareStatement(String sql, long time)
AbstractQueryReport
prepareStatement
in class AbstractQueryReport
sql
- - the string used to prepare the statement withtime
- - the time it took to invoke preparepublic void prepareCall(String sql, long time)
AbstractQueryReport
prepareCall
in class AbstractQueryReport
sql
- - the string used to prepare the statement withtime
- - the time it took to invoke preparepublic void poolStarted(ConnectionPool pool)
poolStarted
in class JdbcInterceptor
pool
- - the pool that is being closed.public void poolClosed(ConnectionPool pool)
poolClosed
in class JdbcInterceptor
pool
- - the pool that is being closed.protected SlowQueryReport.QueryStats getQueryStats(String sql)
protected void removeOldest(ConcurrentHashMap<String,SlowQueryReport.QueryStats> queries)
queries
- public void reset(ConnectionPool parent, PooledConnection con)
AbstractCreateStatementInterceptor
reset
in class AbstractCreateStatementInterceptor
parent
- - the connection pool owning the connectioncon
- - the pooled connectionpublic void setProperties(Map<String,PoolProperties.InterceptorProperty> properties)
JdbcInterceptor
setProperties
in class JdbcInterceptor
|
Apache Tomcat 7.0.28 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |