Class YankPoolManager

java.lang.Object
org.knowm.yank.YankPoolManager

public final class YankPoolManager extends Object
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 Details

  • Method Details

    • addDefaultConnectionPool

      protected void addDefaultConnectionPool(Properties dataSourceProperties)
      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/HikariCP

      This 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

      protected void addConnectionPool(String poolName, Properties connectionPoolProperties)
      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/HikariCP

      Note 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

      protected void releaseConnectionPool(String poolName)
      Closes a connection pool
      Parameters:
      poolName -
    • releaseAllConnectionPools

      protected void releaseAllConnectionPools()
      Closes all connection pools
    • getConnectionPool

      protected com.zaxxer.hikari.HikariDataSource getConnectionPool(String poolName)
      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

      protected void addSQLStatements(Properties sqlProperties)
    • getMergedSqlProperties

      protected Properties getMergedSqlProperties()
      Returns:
      the mergedSqlProperties