public final class HikariPool extends Object implements HikariPoolMBean, ConcurrentBag.IBagStateListener
Constructor and Description |
---|
HikariPool(HikariConfig configuration)
Construct a HikariPool with the specified configuration.
|
HikariPool(HikariConfig configuration,
String username,
String password)
Construct a HikariPool with the specified configuration.
|
Modifier and Type | Method and Description |
---|---|
void |
addBagItem() |
void |
closeConnection(IHikariConnectionProxy connectionProxy)
Permanently close the real (underlying) connection (eat any exception).
|
void |
closeIdleConnections() |
int |
getActiveConnections() |
Connection |
getConnection()
Get a connection from the pool, or timeout trying.
|
DataSource |
getDataSource()
Get the wrapped DataSource.
|
int |
getIdleConnections() |
int |
getThreadsAwaitingConnection() |
int |
getTotalConnections() |
void |
releaseConnection(IHikariConnectionProxy connectionProxy,
boolean isBroken)
Release a connection back to the pool, or permanently close it if it is broken.
|
void |
shutdown()
Shutdown the pool, closing all idle connections and aborting or closing
active connections.
|
String |
toString() |
public HikariPool(HikariConfig configuration)
configuration
- a HikariConfig instancepublic HikariPool(HikariConfig configuration, String username, String password)
configuration
- a HikariConfig instanceusername
- authentication usernamepassword
- authentication passwordpublic Connection getConnection() throws SQLException
SQLException
- thrown if a timeout occurs trying to obtain a connectionpublic void releaseConnection(IHikariConnectionProxy connectionProxy, boolean isBroken)
connectionProxy
- the connection to release back to the poolisBroken
- true if the connection was detected as brokenpublic void shutdown() throws InterruptedException
InterruptedException
- thrown if the thread is interrupted during shutdownpublic DataSource getDataSource()
public void closeConnection(IHikariConnectionProxy connectionProxy)
connectionProxy
- the connection to actually closepublic void addBagItem()
addBagItem
in interface ConcurrentBag.IBagStateListener
public int getActiveConnections()
getActiveConnections
in interface HikariPoolMBean
public int getIdleConnections()
getIdleConnections
in interface HikariPoolMBean
public int getTotalConnections()
getTotalConnections
in interface HikariPoolMBean
public int getThreadsAwaitingConnection()
getThreadsAwaitingConnection
in interface HikariPoolMBean
public void closeIdleConnections()
closeIdleConnections
in interface HikariPoolMBean
Copyright © 2014 Zaxxer.com. All rights reserved.