接口 DataSourcePoolMetadata
- 所有已知实现类:
AbstractDataSourcePoolMetadata,CommonsDbcp2DataSourcePoolMetadata,CommonsDbcpDataSourcePoolMetadata,HikariDataSourcePoolMetadata,TomcatDataSourcePoolMetadata
public interface DataSourcePoolMetadata
Provides access meta-data that is commonly available from most pooledDataSourceimplementations.- 从以下版本开始:
- 1.2.0
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 IntegergetActive()Return the current number of active connections that have been allocated from the data source ornullif that information is not available.IntegergetMax()Return the maximum number of active connections that can be allocated at the same time or-1if there is no limit.IntegergetMin()Return the minimum number of idle connections in the pool ornullif that information is not available.FloatgetUsage()Return the usage of the pool as value between 0 and 1 (or -1 if the pool is not limited).StringgetValidationQuery()Return the query to use to validate that a connection is valid ornullif that information is not available.
方法详细资料
getUsage
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
nullif the data source does not provide the necessary information to compute the poll usage.- 返回:
- the usage value or
null
getActive
Integer getActive()
Return the current number of active connections that have been allocated from the data source ornullif that information is not available.- 返回:
- the number of active connections or
null
getMax
Integer getMax()
Return the maximum number of active connections that can be allocated at the same time or-1if there is no limit. Can also returnnullif that information is not available.- 返回:
- the maximum number of active connections or
null
getMin
Integer getMin()
Return the minimum number of idle connections in the pool ornullif that information is not available.- 返回:
- the minimum number of active connections or
null
getValidationQuery
String getValidationQuery()
Return the query to use to validate that a connection is valid ornullif that information is not available.- 返回:
- the validation query or
null