public class HikariPool extends Object implements HikariPoolMXBean, ConcurrentBag.IBagStateListener
Constructor and Description |
---|
HikariPool(HikariConfig config)
Construct a HikariPool with the specified configuration.
|
Modifier and Type | Method and Description |
---|---|
Future<Boolean> |
addBagItem() |
void |
evictConnection(IHikariConnectionProxy proxyConnection)
Evict a connection from the pool.
|
int |
getActiveConnections() |
Connection |
getConnection()
Get a connection from the pool, or timeout after connectionTimeout milliseconds.
|
Connection |
getConnection(long hardTimeout)
Get a connection from the pool, or timeout after the specified number of milliseconds.
|
DataSource |
getDataSource()
Get the wrapped DataSource.
|
int |
getIdleConnections() |
int |
getThreadsAwaitingConnection() |
int |
getTotalConnections() |
void |
logPoolState(String... prefix)
Log the current pool state at debug level.
|
void |
releaseConnection(PoolBagEntry bagEntry)
Release a connection back to the pool, or permanently close it if it is broken.
|
void |
resumePool() |
void |
setHealthCheckRegistry(Object healthCheckRegistry) |
void |
setMetricRegistry(Object metricRegistry) |
void |
setMetricsTrackerFactory(MetricsTrackerFactory metricsTrackerFactory) |
void |
shutdown()
Shutdown the pool, closing all idle connections and aborting or closing
active connections.
|
void |
softEvictConnections() |
void |
suspendPool() |
String |
toString() |
public HikariPool(HikariConfig config)
config
- a HikariConfig instancepublic final Connection getConnection() throws SQLException
SQLException
- thrown if a timeout occurs trying to obtain a connectionpublic final Connection getConnection(long hardTimeout) throws SQLException
hardTimeout
- the maximum time to wait for a connection from the poolSQLException
- thrown if a timeout occurs trying to obtain a connectionpublic final void releaseConnection(PoolBagEntry bagEntry)
bagEntry
- the PoolBagEntry to release back to the poolpublic final void shutdown() throws InterruptedException
InterruptedException
- thrown if the thread is interrupted during shutdownpublic final void evictConnection(IHikariConnectionProxy proxyConnection)
proxyConnection
- the connection to evictpublic final DataSource getDataSource()
public void setMetricRegistry(Object metricRegistry)
public void setMetricsTrackerFactory(MetricsTrackerFactory metricsTrackerFactory)
public void setHealthCheckRegistry(Object healthCheckRegistry)
public final void logPoolState(String... prefix)
prefix
- an optional prefix to prepend the log messagepublic Future<Boolean> addBagItem()
addBagItem
in interface ConcurrentBag.IBagStateListener
public final int getActiveConnections()
getActiveConnections
in interface HikariPoolMXBean
public final int getIdleConnections()
getIdleConnections
in interface HikariPoolMXBean
public final int getTotalConnections()
getTotalConnections
in interface HikariPoolMXBean
public final int getThreadsAwaitingConnection()
getThreadsAwaitingConnection
in interface HikariPoolMXBean
public void softEvictConnections()
softEvictConnections
in interface HikariPoolMXBean
public final void suspendPool()
suspendPool
in interface HikariPoolMXBean
public final void resumePool()
resumePool
in interface HikariPoolMXBean
Copyright © 2017 Zaxxer.com. All rights reserved.