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
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final YankPoolManagerThe singleton instance -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddConnectionPool(String poolName, Properties connectionPoolProperties) Add properties for a DataSource (connection pool).protected voidaddDefaultConnectionPool(Properties dataSourceProperties) Add properties for a DataSource (connection pool).protected voidaddSQLStatements(Properties sqlProperties) protected com.zaxxer.hikari.HikariDataSourcegetConnectionPool(String poolName) Get a connection poolprotected com.zaxxer.hikari.HikariDataSourceGet the default connection poolprotected Propertiesprotected voidCloses all connection poolsprotected voidreleaseConnectionPool(String poolName) Closes a connection poolprotected voidCloses 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
-