Package io.micronaut.jdbc.metadata
Class AbstractDataSourcePoolMetadata<T extends DataSource>
- java.lang.Object
-
- io.micronaut.jdbc.metadata.AbstractDataSourcePoolMetadata<T>
-
- Type Parameters:
T- the data source type
- All Implemented Interfaces:
DataSourcePoolMetadata<T>
- Direct Known Subclasses:
DbcpDataSourcePoolMetadata,TomcatDataSourcePoolMetadata
public abstract class AbstractDataSourcePoolMetadata<T extends DataSource> extends Object implements DataSourcePoolMetadata<T>
A baseDataSourcePoolMetadataimplementation.- Since:
- 2.0.0
- Author:
- Stephane Nicoll, Christian Oestreich
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDataSourcePoolMetadata(T dataSource)Create an instance with the data source to use.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TgetDataSource()Allow implementations to get the datasource for usage in metrics, etc.FloatgetUsage()Return the usage of the pool as value between 0 and 1 (or -1 if the pool is not limited).-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.micronaut.jdbc.metadata.DataSourcePoolMetadata
getActive, getDefaultAutoCommit, getIdle, getMax, getMin, getValidationQuery
-
-
-
-
Constructor Detail
-
AbstractDataSourcePoolMetadata
protected AbstractDataSourcePoolMetadata(T dataSource)
Create an instance with the data source to use.- Parameters:
dataSource- the data source
-
-
Method Detail
-
getUsage
public Float getUsage()
Description copied from interface:DataSourcePoolMetadataReturn 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.- Specified by:
getUsagein interfaceDataSourcePoolMetadata<T extends DataSource>- Returns:
- the usage value or
null
-
getDataSource
public T getDataSource()
Allow implementations to get the datasource for usage in metrics, etc.- Specified by:
getDataSourcein interfaceDataSourcePoolMetadata<T extends DataSource>- Returns:
- the datasource
-
-