ConnectionPoolMBean (Apache Tomcat 9.0.120 API Documentation)
Description: declaration: package: org.apache.tomcat.jdbc.pool.jmx, interface: ConnectionPoolMBean

# Interface ConnectionPoolMBean

All Superinterfaces:
  `PoolConfiguration`

All Known Implementing Classes:
  `ConnectionPool, DataSource, XADataSource`

public interface ConnectionPoolMBean extends PoolConfiguration
JMX MBean interface for monitoring and managing a JDBC connection pool.

- ## Field Summary

  ### Fields inherited from interface PoolConfiguration

  `PKG_PREFIX`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `checkAbandoned()`
  Checks for and removes abandoned connections from the pool.
  `void`
  `checkIdle()`
  Checks and cleans up idle connections in the pool.
  `int`
  `getActive()`
  Returns the number of active (in-use) connections.
  `long`
  `getBorrowedCount()`
  Returns the total number of connections borrowed since pool creation.
  `long`
  `getCreatedCount()`
  Returns the total number of connections created since pool creation.
  `int`
  `getIdle()`
  Returns the number of idle connections in the pool.
  `int`
  `getNumActive()`
  Returns the number of active (in-use) connections.
  `int`
  `getNumIdle()`
  Returns the number of idle connections in the pool.
  `long`
  `getReconnectedCount()`
  Returns the total number of reconnections since pool creation.
  `long`
  `getReleasedCount()`
  Returns the total number of connections released since pool creation.
  `long`
  `getReleasedIdleCount()`
  Returns the total number of idle connections released by the pool cleaner.
  `long`
  `getRemoveAbandonedCount()`
  Returns the total number of connections removed due to abandonment.
  `long`
  `getReturnedCount()`
  Returns the total number of connections returned since pool creation.
  `int`
  `getSize()`
  Returns the total number of connections in the pool.
  `int`
  `getWaitCount()`
  Returns the number of threads waiting for a connection.
  `void`
  `purge()`
  Purges all connections in the pool.
  `void`
  `purgeOnReturn()`
  Purges connections when they are returned from the pool.
  `void`
  `resetStats()`
  reset the statistics of this pool.
  `void`
  `testIdle()`
  Validates all idle connections in the pool.

  ### Methods inherited from interface PoolConfiguration

  `getAbandonWhenPercentageFull, getCommitOnReturn, getConnectionProperties, getDataSource, getDataSourceJNDI, getDbProperties, getDefaultAutoCommit, getDefaultCatalog, getDefaultReadOnly, getDefaultTransactionIsolation, getDriverClassName, getInitialSize, getInitSQL, getJdbcInterceptors, getJdbcInterceptorsAsArray, getLogValidationErrors, getMaxActive, getMaxAge, getMaxIdle, getMaxWait, getMinEvictableIdleTimeMillis, getMinIdle, getName, getNumTestsPerEvictionRun, getPassword, getPoolName, getPropagateInterruptState, getRemoveAbandonedTimeout, getRollbackOnReturn, getSuspectTimeout, getTimeBetweenEvictionRunsMillis, getUrl, getUseDisposableConnectionFacade, getUseLock, getUsername, getUseStatementFacade, getValidationInterval, getValidationQuery, getValidationQueryTimeout, getValidator, getValidatorClassName, isAccessToUnderlyingConnectionAllowed, isAlternateUsernameAllowed, isDefaultAutoCommit, isDefaultReadOnly, isFairQueue, isIgnoreExceptionOnPreLoad, isJmxEnabled, isLogAbandoned, isPoolSweeperEnabled, isRemoveAbandoned, isTestOnBorrow, isTestOnConnect, isTestOnReturn, isTestWhileIdle, isUseEquals, setAbandonWhenPercentageFull, setAccessToUnderlyingConnectionAllowed, setAlternateUsernameAllowed, setCommitOnReturn, setConnectionProperties, setDataSource, setDataSourceJNDI, setDbProperties, setDefaultAutoCommit, setDefaultCatalog, setDefaultReadOnly, setDefaultTransactionIsolation, setDriverClassName, setFairQueue, setIgnoreExceptionOnPreLoad, setInitialSize, setInitSQL, setJdbcInterceptors, setJmxEnabled, setLogAbandoned, setLogValidationErrors, setMaxActive, setMaxAge, setMaxIdle, setMaxWait, setMinEvictableIdleTimeMillis, setMinIdle, setName, setNumTestsPerEvictionRun, setPassword, setPropagateInterruptState, setRemoveAbandoned, setRemoveAbandonedTimeout, setRollbackOnReturn, setSuspectTimeout, setTestOnBorrow, setTestOnConnect, setTestOnReturn, setTestWhileIdle, setTimeBetweenEvictionRunsMillis, setUrl, setUseDisposableConnectionFacade, setUseEquals, setUseLock, setUsername, setUseStatementFacade, setValidationInterval, setValidationQuery, setValidationQueryTimeout, setValidator, setValidatorClassName`

- ## Method Details

  - ### getSize

    int getSize()
    Returns the total number of connections in the pool.
    Returns:
      total connection count

  - ### getIdle

    int getIdle()
    Returns the number of idle connections in the pool.
    Returns:
      idle connection count

  - ### getActive

    int getActive()
    Returns the number of active (in-use) connections.
    Returns:
      active connection count

  - ### getNumIdle

    int getNumIdle()
    Returns the number of idle connections in the pool.
    Returns:
      idle connection count

  - ### getNumActive

    int getNumActive()
    Returns the number of active (in-use) connections.
    Returns:
      active connection count

  - ### getWaitCount

    int getWaitCount()
    Returns the number of threads waiting for a connection.
    Returns:
      wait count

  - ### getBorrowedCount

    long getBorrowedCount()
    Returns the total number of connections borrowed since pool creation.
    Returns:
      borrowed count

  - ### getReturnedCount

    long getReturnedCount()
    Returns the total number of connections returned since pool creation.
    Returns:
      returned count

  - ### getCreatedCount

    long getCreatedCount()
    Returns the total number of connections created since pool creation.
    Returns:
      created count

  - ### getReleasedCount

    long getReleasedCount()
    Returns the total number of connections released since pool creation.
    Returns:
      released count

  - ### getReconnectedCount

    long getReconnectedCount()
    Returns the total number of reconnections since pool creation.
    Returns:
      reconnected count

  - ### getRemoveAbandonedCount

    long getRemoveAbandonedCount()
    Returns the total number of connections removed due to abandonment.
    Returns:
      abandoned count

  - ### getReleasedIdleCount

    long getReleasedIdleCount()
    Returns the total number of idle connections released by the pool cleaner.
    Returns:
      released idle count

  - ### checkIdle

    void checkIdle()
    Checks and cleans up idle connections in the pool.

  - ### checkAbandoned

    void checkAbandoned()
    Checks for and removes abandoned connections from the pool.

  - ### testIdle

    void testIdle()
    Validates all idle connections in the pool.

  - ### purge

    void purge()
    Purges all connections in the pool. For connections currently in use, these connections will be purged when returned on the pool. This call also purges connections that are idle and in the pool To only purge used/active connections see `purgeOnReturn()`

  - ### purgeOnReturn

    void purgeOnReturn()
    Purges connections when they are returned from the pool. This call does not purge idle connections until they are used. To purge idle connections see `purge()`

  - ### resetStats

    void resetStats()
    reset the statistics of this pool.