Interface DataSourcePoolMetadata

All Known Implementing Classes:
AbstractDataSourcePoolMetadata, CommonsDbcp2DataSourcePoolMetadata, HikariDataSourcePoolMetadata, OracleUcpDataSourcePoolMetadata, TomcatDataSourcePoolMetadata

public interface DataSourcePoolMetadata
Provides access meta-data that is commonly available from most pooled DataSource implementations.
Since:
2.0.0
Author:
Stephane Nicoll, Artsiom Yudovin
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable Integer
    Return the current number of active connections that have been allocated from the data source or null if that information is not available.
    @Nullable Boolean
    The default auto-commit state of connections created by this pool.
    default @Nullable Integer
    Return the number of established but idle connections.
    @Nullable Integer
    Return the maximum number of active connections that can be allocated at the same time or -1 if there is no limit.
    @Nullable Integer
    Return the minimum number of idle connections in the pool or null if that information is not available.
    @Nullable Float
    Return the usage of the pool as value between 0 and 1 (or -1 if the pool is not limited).
    @Nullable String
    Return the query to use to validate that a connection is valid or null if that information is not available.
  • Method Details

    • getUsage

      @Nullable Float getUsage()
      Return the usage of the pool as value between 0 and 1 (or -1 if the pool is not limited).
      • 1 means that the maximum number of connections have been allocated
      • 0 means that no connection is currently active
      • -1 means there is not limit to the number of connections that can be allocated
      This may also return null if the data source does not provide the necessary information to compute the poll usage.
      Returns:
      the usage value or null
    • getActive

      @Nullable Integer getActive()
      Return the current number of active connections that have been allocated from the data source or null if that information is not available.
      Returns:
      the number of active connections or null
    • getIdle

      default @Nullable Integer getIdle()
      Return the number of established but idle connections. Can also return null if that information is not available.
      Returns:
      the number of established but idle connections or null
      Since:
      2.2.0
      See Also:
    • getMax

      @Nullable Integer getMax()
      Return the maximum number of active connections that can be allocated at the same time or -1 if there is no limit. Can also return null if that information is not available.
      Returns:
      the maximum number of active connections or null
    • getMin

      @Nullable Integer getMin()
      Return the minimum number of idle connections in the pool or null if that information is not available.
      Returns:
      the minimum number of active connections or null
    • getValidationQuery

      @Nullable String getValidationQuery()
      Return the query to use to validate that a connection is valid or null if that information is not available.
      Returns:
      the validation query or null
    • getDefaultAutoCommit

      @Nullable Boolean getDefaultAutoCommit()
      The default auto-commit state of connections created by this pool. If not set (null), default is JDBC driver default (If set to null then the java.sql.Connection.setAutoCommit(boolean) method will not be called.)
      Returns:
      the default auto-commit state or null