Class SlowQueryReport.PoolStatistics
- Enclosing class:
SlowQueryReport
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
ConstructorsModifierConstructorDescriptionprotectedPoolStatistics(ConnectionPool pool, String name) Creates the statistics store of one pool. -
Method Summary
Modifier and TypeMethodDescriptionprotected SlowQueryReportJmx.PoolJmxReturns what the reporting subclass has published for this pool with JMX.protected StringgetName()Returns the name this store is published under.protected ConnectionPoolgetPool()Returns the pool this store belongs to while it is still reachable.protected ConcurrentHashMap<String, SlowQueryReport.QueryStats> Returns the statistics map, ornullonce the store has been released with the close of its pool.protected booleanReturns 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 Details
-
PoolStatistics
Creates the statistics store of one pool.- Parameters:
pool- the pool the store belongs toname- the name the store is published under
-
-
Method Details
-
getPool
Returns the pool this store belongs to while it is still reachable.- Returns:
- the owning pool, or
nullonce it has been collected
-
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
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
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
Returns the statistics map, ornullonce the store has been released with the close of its pool.- Returns:
- this pool's query statistics
-