public final class HikariPool extends Object implements HikariPoolMXBean, ConcurrentBag.IBagStateListener
Modifier and Type | Class and Description |
---|---|
static class |
HikariPool.PoolInitializationException |
Constructor and Description |
---|
HikariPool(HikariConfig config)
Construct a HikariPool with the specified configuration.
|
Modifier and Type | Method and Description |
---|---|
Future<Boolean> |
addBagItem(int waiting) |
void |
evictConnection(Connection connection)
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.
|
int |
getIdleConnections() |
int |
getThreadsAwaitingConnection() |
int |
getTotalConnections() |
DataSource |
getUnwrappedDataSource() |
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 Connection getConnection() throws SQLException
SQLException
- thrown if a timeout occurs trying to obtain a connectionpublic 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 void shutdown() throws InterruptedException
InterruptedException
- thrown if the thread is interrupted during shutdownpublic void evictConnection(Connection connection)
connection
- the connection to evictpublic void setMetricRegistry(Object metricRegistry)
public void setMetricsTrackerFactory(MetricsTrackerFactory metricsTrackerFactory)
public void setHealthCheckRegistry(Object healthCheckRegistry)
public Future<Boolean> addBagItem(int waiting)
addBagItem
in interface ConcurrentBag.IBagStateListener
public int getActiveConnections()
getActiveConnections
in interface HikariPoolMXBean
public int getIdleConnections()
getIdleConnections
in interface HikariPoolMXBean
public int getTotalConnections()
getTotalConnections
in interface HikariPoolMXBean
public int getThreadsAwaitingConnection()
getThreadsAwaitingConnection
in interface HikariPoolMXBean
public void softEvictConnections()
softEvictConnections
in interface HikariPoolMXBean
public void suspendPool()
suspendPool
in interface HikariPoolMXBean
public void resumePool()
resumePool
in interface HikariPoolMXBean
public DataSource getUnwrappedDataSource()
Copyright © 2017 Zaxxer.com. All rights reserved.