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:
- InvocationHandler,- NotificationBroadcaster,- NotificationEmitter,- SlowQueryReportJmxMBean
public class SlowQueryReportJmx
extends SlowQueryReport
implements NotificationEmitter, SlowQueryReportJmxMBean
Publishes data to JMX and provides notifications
 when failures happen.
- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportSlowQueryReport.QueryStats, SlowQueryReport.QueryStatsComparatorNested classes/interfaces inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReportAbstractQueryReport.StatementProxy
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Stringprotected static final ConcurrentHashMap<String,SlowQueryReportJmxMBean> protected NotificationBroadcasterSupportprotected booleanprotected static final AtomicLongstatic final Stringprotected ConnectionPoolprotected Stringstatic final Stringprotected static CompositeTypeFields inherited from class org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportlogFailed, logSlow, maxQueries, perPoolStats, queries, queryStatsComparatorFields inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReportthresholdFields 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_TYPESFields 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
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) protected voidprotected static CompositeTypegetObjectName(Class<?> clazz, String poolName) JMX operation - return the name of the poolString[]JMX operation - return the names of all the poolsJMX operation - returns all the queries we have collected.booleanprotected voidvoidpoolClosed(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 voidvoidvoidremoveNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) protected StringreportFailedQuery(String query, Object[] args, String name, long start, Throwable t) Invoked when a query execution, a call to execute/executeQuery or executeBatch failed.protected StringreportSlowQuery(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 thresholdvoidreset(ConnectionPool parent, PooledConnection con) no-op for this interceptor. no state is stored.voidJMX operation - remove all stats for this connection poolvoidsetNotifyPool(boolean notifyPool) voidsetProperties(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 propertiesMethods inherited from class org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReportcloseInvoked, getPoolStats, getQueryStats, isLogFailed, isLogSlow, prepareCall, prepareStatement, removeOldest, reportQuery, setLogFailed, setLogSlow, setMaxQueriesMethods inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractQueryReportcreateStatement, getThreshold, setThresholdMethods inherited from class org.apache.tomcat.jdbc.pool.interceptor.AbstractCreateStatementInterceptorgetConstructor, invoke, isExecute, isStatement, processMethods inherited from class org.apache.tomcat.jdbc.pool.JdbcInterceptorcompare, compare, disconnected, getNext, getProperties, isUseEquals, setNext, setUseEquals
- 
Field Details- 
SLOW_QUERY_NOTIFICATION- See Also:
 
- 
FAILED_QUERY_NOTIFICATION- See Also:
 
- 
objectNameAttribute- See Also:
 
- 
SLOW_QUERY_TYPE
- 
mbeans
- 
notifier
- 
poolName
- 
notifySequence
- 
notifyPoolprotected boolean notifyPool
- 
pool
 
- 
- 
Constructor Details- 
SlowQueryReportJmxpublic SlowQueryReportJmx()
 
- 
- 
Method Details- 
addNotificationListenerpublic void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException - Specified by:
- addNotificationListenerin interface- NotificationBroadcaster
- Throws:
- IllegalArgumentException
 
- 
getNotificationInfo- Specified by:
- getNotificationInfoin interface- NotificationBroadcaster
 
- 
removeNotificationListenerpublic void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException - Specified by:
- removeNotificationListenerin interface- NotificationBroadcaster
- Throws:
- ListenerNotFoundException
 
- 
removeNotificationListenerpublic void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException - Specified by:
- removeNotificationListenerin interface- NotificationEmitter
- Throws:
- ListenerNotFoundException
 
- 
getCompositeType
- 
resetDescription 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
 
- 
poolClosedDescription copied from class:JdbcInterceptorThis 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.
 
- 
poolStartedDescription copied from class:JdbcInterceptorThis 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 String reportFailedQuery(String query, Object[] args, String name, long start, 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
 
- 
notifyJmx
- 
reportSlowQueryDescription 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
 
- 
getPoolNamesJMX operation - return the names of all the pools- Returns:
- - all the names of pools that we have stored data for
 
- 
getPoolNameJMX 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
- 
getSlowQueriesCDJMX operation - returns all the queries we have collected.- Specified by:
- getSlowQueriesCDin interface- SlowQueryReportJmxMBean
- Returns:
- - the slow query report as composite data.
- Throws:
- OpenDataException
 
- 
deregisterJmxprotected void deregisterJmx()
- 
getObjectNamepublic ObjectName getObjectName(Class<?> clazz, String poolName) throws MalformedObjectNameException - Throws:
- MalformedObjectNameException
 
- 
registerJmxprotected void registerJmx()
- 
setPropertiesDescription 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
 
 
-