| |
|
| java.lang.Object org.smartlib.pool.core.SmartPoolFactory
SmartPoolFactory | public class SmartPoolFactory (Code) | | SmartPoolFactory provides a Singleton interface to the
implementation of the PoolManager Interface.
An object of SmartPoolFactory should be loaded with the
configuration file prior to calling any static methods on the class.
Once a object is loaded it maintains a single instance of PoolManager
across all objects and static methods can be directly invoked on the class
without creating any other instance of SmartPoolFactory.
// Creating an instance .
SmartPoolFactory = new SmartPoolFactory();
// using SmartPoolFactory once it is initialised.
Connection conn = SmartPoolFactory.getConnection();
It is advisable to load the SmartPoolFactory on your
application boot up (start-up-servlet in a web application), so that
it is available for other components from the word go.
author: Sachin Shekar Shetty version: 1.0, 02/08/01 |
Constructor Summary | |
public | SmartPoolFactory(File file) This constructor intialises the SmartPoolClass , reads the
configuration from file and loads the PoolManger. | public | SmartPoolFactory() This constructor intialises the SmartPoolClass , reads the
configuration from system property and loads the PoolManger. | public | SmartPoolFactory(String fileName) This constructor intialises the SmartPoolClass , reads the
configuration from fileName and loads the PoolManger. |
SmartPoolFactory | public SmartPoolFactory(File file) throws ConnectionPoolException(Code) | | This constructor intialises the SmartPoolClass , reads the
configuration from file and loads the PoolManger.
Parameters: file - The configuration file. exception: ConnectionPoolException - if there is any problem initialising the pools |
SmartPoolFactory | public SmartPoolFactory() throws ConnectionPoolException(Code) | | This constructor intialises the SmartPoolClass , reads the
configuration from system property and loads the PoolManger.
exception: ConnectionPoolException - if there is any probleminitialising the pools |
SmartPoolFactory | public SmartPoolFactory(String fileName) throws ConnectionPoolException(Code) | | This constructor intialises the SmartPoolClass , reads the
configuration from fileName and loads the PoolManger.
Parameters: file - The absolute configuration file path. exception: ConnectionPoolException - if there is any problem initialising the pools |
addConnectionLeakListener | public static void addConnectionLeakListener(String poolName, ConnectionLeakListener cle) throws ConnectionPoolException(Code) | | This method adds a connection leak listener.The methods of
cle will be called when a leak is detected as per the
pool configuration.
Parameters: poolName - Name of the pool. Parameters: cle - Class implementing ConnectionLeakListener interface. exception: ConnectionPoolException - If there is any problem adding ConnectionLeakListener. |
getConnection | public static Connection getConnection() throws ConnectionPoolException(Code) | | This method returns a Connection from the default connection pool.
The owner of this pool is marked as N/A indicating unknown.
Note: This method blocks if the pool size has reached it's
maximum size and no free connections are available
until a free connection is available. The time period for which this
method blocks depends on the connection-wait-time-out specified in
the configuration file.
Connection from the default pool exception: ConnectionPoolException - if there is any problem getting connection. |
getConnection | public static Connection getConnection(String poolName) throws ConnectionPoolException(Code) | | This method returns a Connection from the pool poolName .
The owner of this pool is marked as N/A indicating unknown.
Note: This method blocks if the pool size has reached it's
maximum size and no free connections are available
until a free connection is available. The time period for which this
method blocks depends on the connection-wait-time-out specified in
the configuration file.
Parameters: poolName - Name of the pool. Connection from the pool exception: ConnectionPoolException - if there is any problem getting connection. |
getConnection | public static Connection getConnection(String poolName, String owner) throws ConnectionPoolException(Code) | | This method returns a Connection from the pool poolName .
The owner of this connection is identified by owner .
Note: This method blocks if the pool size has reached it's
maximum size and no free connections are available
until a free connection is available. The time period for which this
method blocks depends on the connection-wait-time-out specified in
the configuration file.
Parameters: poolName - Name of the pool. Parameters: owner - String identifying the owner. Connection from the pool exception: ConnectionPoolException - if there is any problem getting connection. |
removeConnectionLeakListener | public static void removeConnectionLeakListener(String poolName, ConnectionLeakListener cle) throws ConnectionPoolException(Code) | | This method removes a connection leak listener.cle will
not get any further notifications.
Parameters: poolName - Name of the pool. Parameters: cle - Class implementing ConnectionLeakListener interface. exception: ConnectionPoolException - if there is any problem removing ConnectionLeakListener. |
shutDown | public static void shutDown()(Code) | | This method shuts down the pool, that is closes all connections to the database,
the pool can no longer be used unless reinitialised using a new SmartPoolFactory instance.
|
|
|
|