Class SlowQueryReportJmx
- 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
- 
- org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportJmx
 
 
 
 
 
- 
- All Implemented Interfaces:
- java.lang.reflect.InvocationHandler,- javax.management.NotificationBroadcaster,- javax.management.NotificationEmitter,- SlowQueryReportJmxMBean
 
 public class SlowQueryReportJmx extends SlowQueryReport implements javax.management.NotificationEmitter, SlowQueryReportJmxMBean Publishes data to JMX and provides notifications when failures happen.
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportSlowQueryReport.QueryStats, SlowQueryReport.QueryStatsComparator
 - 
Nested classes/interfaces inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReportAbstractQueryReport.StatementProxy
 
- 
 - 
Field SummaryFields Modifier and Type Field Description static java.lang.StringFAILED_QUERY_NOTIFICATIONprotected static java.util.concurrent.ConcurrentHashMap<java.lang.String,SlowQueryReportJmxMBean>mbeansprotected javax.management.NotificationBroadcasterSupportnotifierprotected booleannotifyPoolprotected static java.util.concurrent.atomic.AtomicLongnotifySequencestatic java.lang.StringobjectNameAttributeprotected ConnectionPoolpoolprotected java.lang.StringpoolNamestatic java.lang.StringSLOW_QUERY_NOTIFICATIONprotected static javax.management.openmbean.CompositeTypeSLOW_QUERY_TYPE- 
Fields inherited from class org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportlogFailed, logSlow, maxQueries, perPoolStats, queries, queryStatsComparator
 - 
Fields inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReportthreshold
 - 
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 SlowQueryReportJmx()
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)protected voidderegisterJmx()protected static javax.management.openmbean.CompositeTypegetCompositeType()javax.management.MBeanNotificationInfo[]getNotificationInfo()javax.management.ObjectNamegetObjectName(java.lang.Class<?> clazz, java.lang.String poolName)java.lang.StringgetPoolName()JMX operation - return the name of the pooljava.lang.String[]getPoolNames()JMX operation - return the names of all the poolsjavax.management.openmbean.CompositeData[]getSlowQueriesCD()JMX operation - returns all the queries we have collected.booleanisNotifyPool()protected voidnotifyJmx(java.lang.String query, java.lang.String type)voidpoolClosed(ConnectionPool pool)This method is invoked by a connection pool when the pool is closed.voidpoolStarted(ConnectionPool pool)This method is invoked by a connection pool when the pool is first started up, usually when the first connection is requested.protected voidregisterJmx()voidremoveNotificationListener(javax.management.NotificationListener listener)voidremoveNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)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.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 thresholdvoidreset(ConnectionPool parent, PooledConnection con)no-op for this interceptor. no state is stored.voidresetStats()JMX operation - remove all stats for this connection poolvoidsetNotifyPool(boolean notifyPool)voidsetProperties(java.util.Map<java.lang.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.SlowQueryReportcloseInvoked, getPoolStats, getQueryStats, isLogFailed, isLogSlow, prepareCall, prepareStatement, removeOldest, reportQuery, setLogFailed, setLogSlow, setMaxQueries
 - 
Methods inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReportcreateStatement, getThreshold, setThreshold
 - 
Methods inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptorgetConstructor, invoke, isExecute, isStatement, process
 - 
Methods inherited from class org.apache.tomcat.jdbc.pool.JdbcInterceptorcompare, compare, disconnected, getNext, getProperties, isUseEquals, setNext, setUseEquals
 
- 
 
- 
- 
- 
Field Detail- 
SLOW_QUERY_NOTIFICATIONpublic static final java.lang.String SLOW_QUERY_NOTIFICATION - See Also:
- Constant Field Values
 
 - 
FAILED_QUERY_NOTIFICATIONpublic static final java.lang.String FAILED_QUERY_NOTIFICATION - See Also:
- Constant Field Values
 
 - 
objectNameAttributepublic static final java.lang.String objectNameAttribute - See Also:
- Constant Field Values
 
 - 
SLOW_QUERY_TYPEprotected static volatile javax.management.openmbean.CompositeType SLOW_QUERY_TYPE 
 - 
mbeansprotected static final java.util.concurrent.ConcurrentHashMap<java.lang.String,SlowQueryReportJmxMBean> mbeans 
 - 
notifierprotected volatile javax.management.NotificationBroadcasterSupport notifier 
 - 
poolNameprotected java.lang.String poolName 
 - 
notifySequenceprotected static final java.util.concurrent.atomic.AtomicLong notifySequence 
 - 
notifyPoolprotected boolean notifyPool 
 - 
poolprotected ConnectionPool pool 
 
- 
 - 
Method Detail- 
addNotificationListenerpublic void addNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback) throws java.lang.IllegalArgumentException- Specified by:
- addNotificationListenerin interface- javax.management.NotificationBroadcaster
- Throws:
- java.lang.IllegalArgumentException
 
 - 
getNotificationInfopublic javax.management.MBeanNotificationInfo[] getNotificationInfo() - Specified by:
- getNotificationInfoin interface- javax.management.NotificationBroadcaster
 
 - 
removeNotificationListenerpublic void removeNotificationListener(javax.management.NotificationListener listener) throws javax.management.ListenerNotFoundException- Specified by:
- removeNotificationListenerin interface- javax.management.NotificationBroadcaster
- Throws:
- javax.management.ListenerNotFoundException
 
 - 
removeNotificationListenerpublic void removeNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback) throws javax.management.ListenerNotFoundException- Specified by:
- removeNotificationListenerin interface- javax.management.NotificationEmitter
- Throws:
- javax.management.ListenerNotFoundException
 
 - 
getCompositeTypeprotected static javax.management.openmbean.CompositeType getCompositeType() 
 - 
resetpublic void reset(ConnectionPool parent, PooledConnection con) Description copied from class:AbstractCreateStatementInterceptorno-op for this interceptor. no state is stored.- Overrides:
- resetin class- SlowQueryReport
- Parameters:
- parent- - the connection pool owning the connection
- con- - the pooled connection
 
 - 
poolClosedpublic void poolClosed(ConnectionPool pool) Description copied from class:SlowQueryReportThis method is invoked by a connection pool when the pool is closed. Interceptor classes can override this method if they keep static variables or other tracking means around. This method is only invoked on a single instance of the interceptor, and not on every instance created.- Overrides:
- poolClosedin class- SlowQueryReport
- Parameters:
- pool- - the pool that is being closed.
 
 - 
poolStartedpublic void poolStarted(ConnectionPool pool) Description copied from class:SlowQueryReportThis method is invoked by a connection pool when the pool is first started up, usually when the first connection is requested. Interceptor classes can override this method if they keep static variables or other tracking means around. This method is only invoked on a single instance of the interceptor, and not on every instance created.- Overrides:
- poolStartedin class- SlowQueryReport
- Parameters:
- pool- - the pool that is being closed.
 
 - 
reportFailedQueryprotected java.lang.String reportFailedQuery(java.lang.String query, java.lang.Object[] args, java.lang.String name, long start, java.lang.Throwable t)Description copied from class:AbstractQueryReportInvoked when a query execution, a call to execute/executeQuery or executeBatch failed.- Overrides:
- reportFailedQueryin class- SlowQueryReport
- 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
 
 - 
notifyJmxprotected void notifyJmx(java.lang.String query, java.lang.String type)
 - 
reportSlowQueryprotected java.lang.String reportSlowQuery(java.lang.String query, java.lang.Object[] args, java.lang.String name, long start, long delta)Description copied from class:AbstractQueryReportInvoked when a query execution, a call to execute/executeQuery or executeBatch succeeded and was exceeded the timing threshold- Overrides:
- reportSlowQueryin class- SlowQueryReport
- 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
 
 - 
getPoolNamespublic java.lang.String[] getPoolNames() JMX operation - return the names of all the pools- Returns:
- - all the names of pools that we have stored data for
 
 - 
getPoolNamepublic java.lang.String getPoolName() JMX operation - return the name of the pool- Returns:
- the name of the pool, unique within the JVM
 
 - 
isNotifyPoolpublic boolean isNotifyPool() 
 - 
setNotifyPoolpublic void setNotifyPool(boolean notifyPool) 
 - 
resetStatspublic void resetStats() JMX operation - remove all stats for this connection pool
 - 
getSlowQueriesCDpublic javax.management.openmbean.CompositeData[] getSlowQueriesCD() throws javax.management.openmbean.OpenDataExceptionJMX operation - returns all the queries we have collected.- Specified by:
- getSlowQueriesCDin interface- SlowQueryReportJmxMBean
- Returns:
- - the slow query report as composite data.
- Throws:
- javax.management.openmbean.OpenDataException
 
 - 
deregisterJmxprotected void deregisterJmx() 
 - 
getObjectNamepublic javax.management.ObjectName getObjectName(java.lang.Class<?> clazz, java.lang.String poolName) throws javax.management.MalformedObjectNameException- Throws:
- javax.management.MalformedObjectNameException
 
 - 
registerJmxprotected void registerJmx() 
 - 
setPropertiespublic void setProperties(java.util.Map<java.lang.String,PoolProperties.InterceptorProperty> properties) Description copied from class:JdbcInterceptorCalled 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- Overrides:
- setPropertiesin class- SlowQueryReport
- Parameters:
- properties- The properties
 
 
- 
 
-