org.jwarp.service.connectionpool
Interface IConnectionPoolService

All Superinterfaces:
IConfigurable, IExceptionProvider, IService

public interface IConnectionPoolService
extends IService

Interface for the connection-pool service

Version:
1.0
Author:
Anatole Tresch

Field Summary
static java.lang.String SERVICE_TYPE
          Service type string constant
 
Fields inherited from interface org.jwarp.service.IService
SERVICE_STATUS_CREATED, SERVICE_STATUS_NOT_AVAILABLE, SERVICE_STATUS_READY, SERVICE_STATUS_RESUMING, SERVICE_STATUS_RUNNING, SERVICE_STATUS_STARTING, SERVICE_STATUS_STOPPED, SERVICE_STATUS_STOPPING, SERVICE_STATUS_SUSPENDED
 
Method Summary
 void addPool(ConnectionPool pool, ITicket user)
          Ad a new pool to the service.
 void checkFreeConnections()
          Checkes for too many free connections.
 java.sql.Connection getConnection(java.lang.String poolName, ITicket user)
          Get a connection from the given pool.
 java.lang.String[] getDrivers()
          Get the actual loaded drivers
 ConnectionPool getPool(java.lang.String name, ITicket user)
          Get the pool named name
 java.lang.String[] getPoolNames()
          Get a list of names of all managed pools
 void release(ITicket ticket)
          Tries to tell all pools managed by this manager to release all connections.
 void removePool(java.lang.String poolName, ITicket user)
          Remove the pool with the given name.
 
Methods inherited from interface org.jwarp.service.IService
checkContext, getDependencies, getLogLevel, getName, getStatus, getType, resume, setContext, setDependencies, setLogLevel, shutdown, start, suspend
 
Methods inherited from interface org.jwarp.service.configuration.IConfigurable
configure
 
Methods inherited from interface org.jwarp.common.IExceptionProvider
addExceptionListener, getExceptionListeners, removeAllExceptionListeners, removeExceptionListener
 

Field Detail

SERVICE_TYPE

public static final java.lang.String SERVICE_TYPE
Service type string constant
Method Detail

addPool

public void addPool(ConnectionPool pool,
                    ITicket user)
             throws java.lang.SecurityException
Ad a new pool to the service.
Parameters:
A - new connection pool
user - The user
Throws:
java.lang.SecurityException - If access to this pool was denied.

removePool

public void removePool(java.lang.String poolName,
                       ITicket user)
                throws InvalidPoolException,
                       java.lang.SecurityException
Remove the pool with the given name.
Parameters:
name - The pools name
user - The user
Throws:
InvalidPoolException - If the requested pool could not be located.
java.lang.SecurityException - If access to this pool was denied.

getPool

public ConnectionPool getPool(java.lang.String name,
                              ITicket user)
                       throws InvalidPoolException,
                              java.lang.SecurityException
Get the pool named name
Parameters:
name - The pools name
Returns:
the pool or null if the pool does not exist.
Throws:
InvalidPoolException - If the requested pool could not be located.
java.lang.SecurityException - If access to this pool was denied.

getPoolNames

public java.lang.String[] getPoolNames()
                                throws java.lang.SecurityException
Get a list of names of all managed pools
Returns:
An enumeration of all defined pools.

getDrivers

public java.lang.String[] getDrivers()
Get the actual loaded drivers

getConnection

public java.sql.Connection getConnection(java.lang.String poolName,
                                         ITicket user)
                                  throws InvalidPoolException,
                                         MaxConnectException,
                                         java.lang.SecurityException
Get a connection from the given pool.
Parameters:
The - pool name.
Returns:
A database connection.
Throws:
InvalidPoolException - if the specified pool can not be found
MaxConnectException - if all connections are checked out
java.lang.SecurityException - If access to this pool was denied.

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(ITicket ticket)
             throws java.lang.SecurityException
Tries to tell all pools managed by this manager to release all connections.
Throws:
java.lang.SecurityException - If access to this pool was denied.

©   O R C A   S y s t e m s