Class SlowQueryReport.PoolStatistics

java.lang.Object
org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport.PoolStatistics
Enclosing class:
SlowQueryReport

protected static class SlowQueryReport.PoolStatistics extends Object
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 Details

    • PoolStatistics

      protected PoolStatistics()
  • Method Details

    • addLivePool

      protected void addLivePool(ConnectionPool pool)
      Registers a pool that started under this name.
      Parameters:
      pool - the connection pool that has started
    • removeLivePool

      protected boolean removeLivePool(ConnectionPool pool)
      Deregisters a pool that closed.
      Parameters:
      pool - the connection pool that has been closed
      Returns:
      true if 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:
      true if another live pool shares this name
    • hasLivePool

      protected boolean hasLivePool(ConnectionPool pool)
      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 the ConcurrentHashMap.compute that 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:
      true if the pool is registered as live under this name
    • getQueryStats

      Returns the statistics map published under this name.
      Returns:
      the shared query statistics map