org.jwarp.service.connectionpool
Interface IPoolService
- All Superinterfaces:
- IConfigurable, IExceptionProvider, IService
- All Known Implementing Classes:
- PoolService
- public interface IPoolService
- extends IService
Poolmanager for managing the application's database access. A poolmanager can be initialised
for loading all db drivers needed. Connection pools can be defined and used for getting
connections. Effectively not direct connections will be returned but wrappers that wrap
the java.sql.Connection interface. If you use a connection from this pool just call close
when you are finished using the connection. The connection itself knows to which pool she should
be returned. The poolmanager is implemented as a singleton.
- Version:
- 1.0
- Author:
- Anatole Tresch
|
Field Summary |
static java.lang.String |
SERVICE_TYPE
The basic service type. |
|
Method Summary |
void |
checkFreeConnections()
Checkes for too many free connections. |
void |
createPool(java.lang.String poolName,
java.lang.String dbDriver,
java.lang.String dbUrl,
java.lang.String dbUid,
java.lang.String dbPwd,
int dbInitConns,
int dbMaxConns,
int dbConnectTimeout,
java.lang.String logTarget,
ITicket ticket)
Create a new db pool. |
java.sql.Connection |
getConnection(java.lang.String poolName,
ITicket ticket)
Get a connection from the given pool. |
java.util.Iterator |
getDrivers(ITicket ticket)
Get the actual loaded drivers |
ConnectionPool |
getPool(java.lang.String name,
ITicket ticket)
Get the pool named name |
java.util.Iterator |
getPools(ITicket ticket)
Get a list of all managed pools |
void |
release()
Tries to tell all pools managed by this manager to release all connections. |
void |
removePool(java.lang.String poolName,
ITicket ticket)
Remove a db pool. |
| Methods inherited from interface org.jwarp.service.IService |
checkContext, getDependencies, getLogLevel, getName, getStatus, getType, resume, setContext, setDependencies, setLogLevel, shutdown, start, suspend |
SERVICE_TYPE
public static final java.lang.String SERVICE_TYPE
- The basic service type.
createPool
public void createPool(java.lang.String poolName,
java.lang.String dbDriver,
java.lang.String dbUrl,
java.lang.String dbUid,
java.lang.String dbPwd,
int dbInitConns,
int dbMaxConns,
int dbConnectTimeout,
java.lang.String logTarget,
ITicket ticket)
throws java.lang.SecurityException,
java.sql.SQLException
- Create a new db pool.
removePool
public void removePool(java.lang.String poolName,
ITicket ticket)
throws java.lang.SecurityException
- Remove a db pool.
getPool
public ConnectionPool getPool(java.lang.String name,
ITicket ticket)
throws java.lang.SecurityException
- Get the pool named name
- Parameters:
name - The pools name- Returns:
- the pool or null if the pool does not exist.
getPools
public java.util.Iterator getPools(ITicket ticket)
throws java.lang.SecurityException
- Get a list of all managed pools
- Returns:
- An enumeration of all defined pools.
getDrivers
public java.util.Iterator getDrivers(ITicket ticket)
throws java.lang.SecurityException
- Get the actual loaded drivers
getConnection
public java.sql.Connection getConnection(java.lang.String poolName,
ITicket ticket)
throws java.lang.SecurityException,
InvalidPoolException,
MaxConnectException
- Get a connection from the given pool.
- Parameters:
The - pool name.- Returns:
- A database connection.
- Throws:
InvalidPoolException - if the specified pool can not be foundMaxConnectException - if all connections are checked out
checkFreeConnections
public void checkFreeConnections()
- Checkes for too many free connections. If there are too many some connections will be closed
and removed from the pool. Called by ConnectionPoolUpdateThread.
- See Also:
ConnectionPoolUpdateThread
release
public void release()
- Tries to tell all pools managed by this manager to release all connections.