Class SlowQueryReport.PoolStatistics
java.lang.Object
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.PoolStatistics
- Enclosing class:
SlowQueryReport
The query statistics published under one pool name, together with the live pools registered for that name.
ConnectionPool does not override
equals or hashCode, so pool membership is by instance identity.
Instances are mutated only from within a ConcurrentHashMap.compute on their name key, which serialises
them against each other.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddLivePool(ConnectionPool pool) Registers a pool that started under this name.protected ConcurrentHashMap<String, SlowQueryReport.QueryStats> Returns the statistics map published under this name.protected booleanhasLivePool(ConnectionPool pool) Returns whether the given pool is one of the live pools registered under this name.protected booleanReturns whether pools other than the caller's own are registered under this name.protected booleanremoveLivePool(ConnectionPool pool) Deregisters a pool that closed.
-
Constructor Details
-
PoolStatistics
protected PoolStatistics()
-
-
Method Details
-
addLivePool
Registers a pool that started under this name.- Parameters:
pool- the connection pool that has started
-
removeLivePool
Deregisters a pool that closed.- Parameters:
pool- the connection pool that has been closed- Returns:
trueif this was the last live pool registered under the name, so the statistics can be released
-
hasOtherLivePools
protected boolean hasOtherLivePools()Returns whether pools other than the caller's own are registered under this name. The caller registers its own pool before asking, so more than one registration means another live pool shares the name.- Returns:
trueif another live pool shares this name
-
hasLivePool
Returns whether the given pool is one of the live pools registered under this name. The live-pool set is concurrent, so this plain membership read is safe outside theConcurrentHashMap.computethat mutates it: it tells a caller, without making a concurrent start wait behind a lock, whether the name is still held live by the given pool.- Parameters:
pool- the pool to look for- Returns:
trueif the pool is registered as live under this name
-
getQueryStats
Returns the statistics map published under this name.- Returns:
- the shared query statistics map
-