Class SlowQueryReport.PoolStatistics
- java.lang.Object
-
- org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.PoolStatistics
-
- Enclosing class:
- SlowQueryReport
protected static class SlowQueryReport.PoolStatistics extends java.lang.ObjectThe query statistics of one pool: the map its connections book into and the name the map is published under.The store refers to the pool only weakly. The name identifies the pool and must be unique among live pools - Tomcat names every pool it manages, and the default name of a programmatic pool is unique as well - so the store can outlive a pool abandoned without closing without pinning that pool, together with everything it reaches: its queues, its pooled connections and their open physical sessions. The weak reference is what tells a live holder of the name from an abandoned pool's leftover store.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPoolStatistics(ConnectionPool pool, java.lang.String name)Creates the statistics store of one pool.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SlowQueryReportJmx.PoolJmxgetJmxState()Returns what the reporting subclass has published for this pool with JMX.protected java.lang.StringgetName()Returns the name this store is published under.protected ConnectionPoolgetPool()Returns the pool this store belongs to while it is still reachable.protected java.util.concurrent.ConcurrentHashMap<java.lang.String,SlowQueryReport.QueryStats>getQueryStats()Returns the statistics map, ornullonce the store has been released with the close of its pool.protected booleanisReleased()Returns whether this store has been released with the close of its pool.protected voidrelease()Releases the store with the close of its pool: later reads of its statistics answer as if nothing were published, and the JMX state published for this pool is given up with it.protected voidsetJmxState(SlowQueryReportJmx.PoolJmx jmxState)Records what the reporting subclass has published for this pool, so that the release of this store gives it up.
-
-
-
Constructor Detail
-
PoolStatistics
protected PoolStatistics(ConnectionPool pool, java.lang.String name)
Creates the statistics store of one pool.- Parameters:
pool- the pool the store belongs toname- the name the store is published under
-
-
Method Detail
-
getPool
protected ConnectionPool getPool()
Returns the pool this store belongs to while it is still reachable.- Returns:
- the owning pool, or
nullonce it has been collected
-
getName
protected java.lang.String getName()
Returns the name this store is published under.- Returns:
- the pool name recorded when the store was created
-
isReleased
protected boolean isReleased()
Returns whether this store has been released with the close of its pool.- Returns:
trueif the pool's close has given this store up
-
getJmxState
protected SlowQueryReportJmx.PoolJmx getJmxState()
Returns what the reporting subclass has published for this pool with JMX.- Returns:
- the pool's JMX state, or
nullwhile no borrow of the pool has needed one or after the store has been released with its pool's close
-
setJmxState
protected void setJmxState(SlowQueryReportJmx.PoolJmx jmxState)
Records what the reporting subclass has published for this pool, so that the release of this store gives it up. Callers publish one state per store under this store's monitor (seeSlowQueryReportJmx).- Parameters:
jmxState- the state to hang from this store
-
release
protected void release()
Releases the store with the close of its pool: later reads of its statistics answer as if nothing were published, and the JMX state published for this pool is given up with it.Whether a state exists is decided under this store's monitor, which is the one a borrow publishes a new state under, so no state can be created behind the release and left for nothing to give up. The state's own release then runs outside the monitor: it gives the MBean back to the MBeanServer, and a close has no business holding the store while it does.
-
getQueryStats
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,SlowQueryReport.QueryStats> getQueryStats()
Returns the statistics map, ornullonce the store has been released with the close of its pool.- Returns:
- this pool's query statistics
-
-