Package org.knowm.yank
Class YankPoolManager
java.lang.Object
org.knowm.yank.YankPoolManager
This class is a Singleton that provides access to one or more connection pools defined in a
Property file. When the client shuts down it should call the release() method to close all open
connections and do other clean up.
This class should not be directly accessed by client code.
- Author:
- timmolter
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
protected static final YankPoolManager
The singleton instance -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addConnectionPool
(String poolName, Properties connectionPoolProperties) Add properties for a DataSource (connection pool).protected void
addDefaultConnectionPool
(Properties dataSourceProperties) Add properties for a DataSource (connection pool).protected void
addSQLStatements
(Properties sqlProperties) protected com.zaxxer.hikari.HikariDataSource
getConnectionPool
(String poolName) Get a connection poolprotected com.zaxxer.hikari.HikariDataSource
Get the default connection poolprotected Properties
protected void
Closes all connection poolsprotected void
releaseConnectionPool
(String poolName) Closes a connection poolprotected void
Closes the default connection pool
-
Field Details
-
INSTANCE
The singleton instance -
DEFAULT_POOL_NAME
- See Also:
-
-
Method Details
-
addDefaultConnectionPool
Add properties for a DataSource (connection pool). Yank uses a Hikari DataSource (connection pool) under the hood, so you have to provide the minimal essential properties and the optional properties as defined here: https://github.com/brettwooldridge/HikariCPThis convenience method will create a connection pool in the default pool.
Note that if you call this method repeatedly, the existing default pool will be first shutdown each time.
- Parameters:
dataSourceProperties
-
-
addConnectionPool
Add properties for a DataSource (connection pool). Yank uses a Hikari DataSource (connection pool) under the hood, so you have to provide the minimal essential properties and the optional properties as defined here: https://github.com/brettwooldridge/HikariCPNote that if you call this method providing a poolName corresponding to an existing connection pool, the existing pool will be first shutdown.
- Parameters:
poolName
-connectionPoolProperties
-
-
releaseDefaultConnectionPool
protected void releaseDefaultConnectionPool()Closes the default connection pool -
releaseConnectionPool
Closes a connection pool- Parameters:
poolName
-
-
releaseAllConnectionPools
protected void releaseAllConnectionPools()Closes all connection pools -
getConnectionPool
Get a connection pool- Returns:
- a connection pool by name
-
getDefaultConnectionPool
protected com.zaxxer.hikari.HikariDataSource getDefaultConnectionPool()Get the default connection pool- Returns:
- the default connection pool
-
addSQLStatements
-
getMergedSqlProperties
- Returns:
- the mergedSqlProperties
-