|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--connectionpool.SmartPoolFactory
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.
| Constructor Summary | |
SmartPoolFactory(java.io.File file)
This constructor intialises the SmartPoolClass , reads the configuration from file and loads the PoolManger. |
|
SmartPoolFactory(java.lang.String fileName)
This constructor intialises the SmartPoolClass , reads the configuration from fileName and loads the PoolManger. |
|
| Method Summary | |
static void |
addConnectionLeakListener(java.lang.String poolName,
ConnectionLeakListener cle)
This method adds a connection leak listener.The methods of cle will be called when a leak is detected as per the
pool configuration. |
static java.sql.Connection |
getConnection()
This method returns a Connection from the default connection pool. |
static java.sql.Connection |
getConnection(java.lang.String poolName)
This method returns a Connection from the pool poolName. |
static java.sql.Connection |
getConnection(java.lang.String poolName,
java.lang.String owner)
This method returns a Connection from the pool poolName. |
static PoolMonitor |
getPoolMonitor(java.lang.String poolName)
This method returns the instance of PoolMonitor for the pool poolName |
static void |
main(java.lang.String[] arg)
|
static void |
removeConnectionLeakListener(java.lang.String poolName,
ConnectionLeakListener cle)
This method removes a connection leak listener. cle will
not get any further notifications. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public SmartPoolFactory(java.io.File file)
throws ConnectionPoolException
file and loads the PoolManger.file - The configuration file.
public SmartPoolFactory(java.lang.String fileName)
throws ConnectionPoolException
fileName and loads the PoolManger.file - The absolute configuration file path.| Method Detail |
public static java.sql.Connection getConnection()
throws ConnectionPoolException
public static java.sql.Connection getConnection(java.lang.String poolName)
throws ConnectionPoolException
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.poolName - Name of the pool.
public static java.sql.Connection getConnection(java.lang.String poolName,
java.lang.String owner)
throws ConnectionPoolException
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.poolName - Name of the pool.owner - String identifying the owner.
public static void addConnectionLeakListener(java.lang.String poolName,
ConnectionLeakListener cle)
throws ConnectionPoolException
cle will be called when a leak is detected as per the
pool configuration.poolName - Name of the pool.cle - Class implementing ConnectionLeakListener interface.
public static void removeConnectionLeakListener(java.lang.String poolName,
ConnectionLeakListener cle)
throws ConnectionPoolException
cle will
not get any further notifications.poolName - Name of the pool.cle - Class implementing ConnectionLeakListener interface.
public static PoolMonitor getPoolMonitor(java.lang.String poolName)
throws ConnectionPoolException
poolNamepoolName - Name of the pool.
public static void main(java.lang.String[] arg)
throws java.lang.Exception
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||