Package net.datenwerke.dbpool
Interface DbPoolService<C>
- Type Parameters:
C-
- All Known Implementing Classes:
DbC3p0PoolServiceImpl,DbPoolServiceImpl,MetaPoolService
public interface DbPoolService<C>
A service that provides database connections. The service allows to pool the
connections.
-
Method Summary
Modifier and TypeMethodDescriptiongetConnection(ConnectionPoolConfig config) Retrieves aFuturethat contains a connection config for the pool specified by the suppliedConnectionPoolConfigobject.getConnection(ConnectionPoolConfig poolConfig, ConnectionConfig connConfig) Retrieves aFuturethat contains a connection object for the pool specified by the suppliedConnectionPoolConfigobject.getDataSource(ConnectionPoolConfig config) getDataSource(ConnectionPoolConfig poolConfig, ConnectionConfig connConfig) Returns a map of all active pools.booleanisActive()Returns true if an active pool exists.voidAsks all available connection pools to be closedvoidshutdownPool(ConnectionPoolConfig poolConfig) Shuts down the pool identified by theConnectionPoolConfigobject.
-
Method Details
-
getConnection
Retrieves aFuturethat contains a connection config for the pool specified by the suppliedConnectionPoolConfigobject.- Parameters:
config- The config object specifying the connection pool- Returns:
- A connection wrapped in a
Future - Throws:
SQLException
-
isActive
boolean isActive()Returns true if an active pool exists. -
getConnection
Future<Connection> getConnection(ConnectionPoolConfig poolConfig, ConnectionConfig connConfig) throws SQLException Retrieves aFuturethat contains a connection object for the pool specified by the suppliedConnectionPoolConfigobject. The connection is configured as specified by theConnectionConfig.- Parameters:
poolConfig- The config object specifying the poolconnConfig- A config object specifying connection properties- Returns:
- A connection wrapped in a
Future - Throws:
SQLException
-
getDataSource
-
getDataSource
-
getPoolMap
Map<ConnectionPoolConfig,C> getPoolMap()Returns a map of all active pools. -
shutdownPool
Shuts down the pool identified by theConnectionPoolConfigobject.- Parameters:
poolConfig- The pool identifier
-
shutdownAll
void shutdownAll()Asks all available connection pools to be closed
-