Class SlowQueryReportJmx.Registration
- All Implemented Interfaces:
NotificationBroadcaster, NotificationEmitter, SlowQueryReportJmx.RegistrationMBean, SlowQueryReportJmxMBean
- Enclosing class:
SlowQueryReportJmx
It holds the name, the statistics store of the pool it reports for, and that pool's JMX state, and nothing else:
every attribute and operation it serves reads the store and the pool's broadcaster exactly as an interceptor
instance of the pool would. Keeping the pool out of the resource is the point: the MBeanServer outlives a pool
that was abandoned without closing, and a resource that reached the pool would pin it, its sessions and its
classloader for the life of the JVM, since a registration is only ever taken down by a close the abandoned pool
never runs. The published surface is unchanged by this indirection: SlowQueryReportJmxMBean plus the
notification methods of NotificationEmitter, with listeners landing on the pool's shared broadcaster.
The ObjectName is deliberately not among what it holds: the name a publication occupies is recorded by the pool's
SlowQueryReportJmx.PoolJmx, which is also what gives it up, so the resource cannot be the one to give up a name other than
the one it was published under - and does not need to know any.
The class is public because the Standard-MBean introspection publishes the resource through its interfaces;
instances are created only by SlowQueryReportJmx.registerJmx().
-
Constructor Summary
ConstructorsConstructorDescriptionRegistration(String poolName, SlowQueryReport.PoolStatistics statistics, SlowQueryReportJmx.PoolJmx state) Creates the registration of one pool. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) Returns the registration name of the connection pool this MBean reports for, as thePoolNameattribute.String[]Returns the names of all the connection pools this JVM currently holds recorded query statistics for, as thePoolNamesattribute.Returns slow query statistics as JMX CompositeData, as theSlowQueriesCDattribute.voidvoidremoveNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) voidRemoves all query statistics recorded for the pool this MBean reports for, so an operator can start from a clean slate instead of restarting the pool.
-
Constructor Details
-
Registration
public Registration(String poolName, SlowQueryReport.PoolStatistics statistics, SlowQueryReportJmx.PoolJmx state) Creates the registration of one pool.- Parameters:
poolName- the pool name to report forstatistics- the statistics store of the pool the registration reports forstate- the JMX state of that pool
-
-
Method Details
-
getPoolName
Description copied from interface:SlowQueryReportJmxMBeanReturns the registration name of the connection pool this MBean reports for, as thePoolNameattribute. The registration, the notifications and the statistics belong to that one pool; a second live pool configured with the same name does not share this MBean, and its registration is refused while this one holds the name.The value is recorded when the pool starts. It is not cleared when the pool's chain is released, so it can remain non-null after the MBean has been given up; only an instance that was never bound to a pool answers
null.- Specified by:
getPoolNamein interfaceSlowQueryReportJmxMBean- Returns:
- the pool's recorded registration name, or
nullbefore this instance is bound to a pool
-
getPoolNames
Description copied from interface:SlowQueryReportJmxMBeanReturns the names of all the connection pools this JVM currently holds recorded query statistics for, as thePoolNamesattribute. That is a JVM-wide view, not this pool alone: a pool using the plainSlowQueryReportinterceptor, which never registers an MBean of its own, appears here as well, and pools configured with the same name appear once.- Specified by:
getPoolNamesin interfaceSlowQueryReportJmxMBean- Returns:
- the names of the pools that currently hold a statistics map; an empty array when no pool has registered statistics
-
resetStats
public void resetStats()Description copied from interface:SlowQueryReportJmxMBeanRemoves all query statistics recorded for the pool this MBean reports for, so an operator can start from a clean slate instead of restarting the pool. Only that pool's store is cleared; another live pool's statistics are untouched, even if it shares the name (a configuration the pool does not support for JMX publication). Only the recorded content is dropped: the pool stays monitored and keeps accumulating statistics afterwards, and a query recorded again starts from empty counters.- Specified by:
resetStatsin interfaceSlowQueryReportJmxMBean
-
getSlowQueriesCD
Description copied from interface:SlowQueryReportJmxMBeanReturns slow query statistics as JMX CompositeData, as theSlowQueriesCDattribute. The element schema isSlowQueryReport.QueryStats: every duration (maxInvocationTime,minInvocationTime,totalInvocationTime,prepareTime) is in milliseconds and every date field (maxInvocationDate,minInvocationDate,lastInvocation) is epoch milliseconds.- Specified by:
getSlowQueriesCDin interfaceSlowQueryReportJmxMBean- Returns:
- array of composite data representing slow query statistics
- Throws:
OpenDataException- if the composite data cannot be created; a JMX client gets it wrapped in anMBeanException
-
addNotificationListener
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException - Specified by:
addNotificationListenerin interfaceNotificationBroadcaster- Throws:
IllegalArgumentException
-
getNotificationInfo
- Specified by:
getNotificationInfoin interfaceNotificationBroadcaster
-
removeNotificationListener
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException - Specified by:
removeNotificationListenerin interfaceNotificationBroadcaster- Throws:
ListenerNotFoundException
-
removeNotificationListener
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException - Specified by:
removeNotificationListenerin interfaceNotificationEmitter- Throws:
ListenerNotFoundException
-