Multi RDBMS Connection Pool (Aspire 2)

From wiki.searchtechnologies.com
Jump to: navigation, search

For Information on Aspire 3.1 Click Here


Multi RDBMS Connection Pool (Aspire 2)
Factory Name  com.searchtechnologies.aspire:aspire-multiple-rdb
subType  default
Inputs  None
Outputs  Via interface

The Aspire Multi RDBMS Connection Pool Component maintains one or more connection pools to relational databases using the JDBC connector. When requesting a connection to a database, one is returned from a connection pool if the pool exists and has a connection that is not in use. If there is no pool for the requested database, one is created. If there are no available connections in the pool, then a new one will be allocated. Optionally, after a configurable period of time, connections can be purged from the pools, releasing database resources. You may also specify a threshold of available connections, below which the pools will not be purged.

The component supports the MultiRDBMSConnectionPool.java interface, with requests for a connection returning MultiRDBMSConnection.java.

The connection pool are based on all the parameters passed to the call (username, password, url, driver file, driver class and properties) and a call that uses different parameters will use a different pool, even if behind the scenes the values may be the same (for instance calls using a relative versus an absolute value for a driver file, or where one call uses the default value for the driver class and another passes none).

Configuration

Element Type Default Description
timeout int 0
(= connections never closed)
The time in ms after which a connection in the pool should be considered for closing and purging from the pool. NOTE: the connection will not actually be closed until the next purge, so still could be reused if a request for a connection is received before the next purge occurs.
purgeThreshold int 0
(= infinite connections)
The minimum number of available connections in the pool before a purge will take place. It is not guaranteed that the pool will ever have this many connections available, but the pool will not be purged unless it does.
purgePoll int 60000
(= 60s)
The period in ms between purges of the connection pool.


Example Configuration

  <component name="RDBConnection" subType="default" factoryName="aspire-multiple-rdb">
    <purgePoll>300000</purgePoll>
    <purgeThreshold>10</purgeThreshold>
    <timeout>3600000</timeout>
  </component>


Obtaining RDB Connections from Components

This component can provide other components with RDB connections. It achieves this by implementing the MultiRDBMSConnectionPool.java and MultiRDBMSConnection.java interfaces. When a connection to an RDB is required, the developer should use the MultiRDBMSConnectionPool interface, passing the appropriate connection parameters to obtain a MultiRDBMSConnection. This can then be used to get information about the pool associated with this connection, return the connection to the pool or to access the java.sql.connection to the database.

Components wishing to access this functionality should main a service tracker to this component, get an instance an then call the appropraite method. See here for further details.