001: /*
002: * @(#) PoolManager 1.0 02/08/01
003: */
004:
005: package org.smartlib.pool.core;
006:
007: import java.sql.*;
008:
009: /**
010: * This interface defines the behavior of the class that will manage
011: * various pools and provide a single access point to the pools.
012: *
013: * @author Sachin Shekar Shetty
014: * @version 1.0, 02/08/01
015: */
016:
017: public interface PoolManager {
018:
019: /**
020: * This method returns a Connection from the default connection pool.
021: * The owner of this pool is marked as N/A indicating unknown.
022: *
023: * <b>Note: This method blocks if the pool size has reached it's
024: * maximum size and no free connections are available
025: * until a free connection is available.</b> The time period for which this
026: * method blocks depends on the connection-wait-time-out specified in
027: * the configuration file.
028: *
029: *
030: *
031: * @return Connection from the default pool
032: * @exception ConnectionPoolException if there is any problem
033: * getting connection.
034: */
035: public Connection getConnection() throws ConnectionPoolException;
036:
037: /**
038: * This method returns a Connection from the pool <code>poolName</code>.
039: * The owner of this pool is marked as N/A indicating unknown.
040: *
041: * <b>Note: This method blocks if the pool size has reached it's
042: * maximum size and no free connections are available
043: * until a free connection is available.</b> The time period for which this
044: * method blocks depends on the connection-wait-time-out specified in
045: * the configuration file.
046: *
047: *
048: * @param poolName Name of the pool.
049: * @return Connection from the pool
050: * @exception ConnectionPoolException if there is any problem
051: * getting connection.
052: */
053: public Connection getConnection(String poolName)
054: throws ConnectionPoolException;
055:
056: /**
057: * This method returns a Connection from the pool <code>poolName</code>.
058: * The owner of this connection is identified by <code>owner</code> .
059: *
060: * <b>Note: This method blocks if the pool size has reached it's
061: * maximum size and no free connections are available
062: * until a free connection is available.</b> The time period for which this
063: * method blocks depends on the connection-wait-time-out specified in
064: * the configuration file.
065: *
066: * @param poolName Name of the pool.
067: * @param owner String identifying the owner.
068: * @return Connection from the pool
069: *
070: * @exception ConnectionPoolException if there is any problem
071: * getting connection.
072: */
073:
074: public Connection getConnection(String poolName, String owner)
075: throws ConnectionPoolException;
076:
077: /**
078: * This method adds a connection leak listener.The methods of
079: * <code>cle</code> will be called when a leak is detected as per the
080: * pool configuration.
081: *
082: * @param poolName Name of the pool.
083: * @param cle Class implementing ConnectionLeakListener interface.
084: * @exception ConnectionPoolException If there is any problem
085: * adding ConnectionLeakListener.
086: */
087: public void addConnectionLeakListener(String poolName,
088: ConnectionLeakListener cle) throws ConnectionPoolException;
089:
090: /**
091: * This method removes a connection leak listener.<code>cle</code> will
092: * not get any further notifications.
093: *
094: * @param poolName Name of the pool.
095: * @param cle Class implementing ConnectionLeakListener interface.
096: * @exception ConnectionPoolException If there is any problem
097: * removing ConnectionLeakListener.
098: */
099: public void removeConnectionLeakListener(String poolName,
100: ConnectionLeakListener cle) throws ConnectionPoolException;
101:
102: /**
103: * This method returns the instance of PoolMonitor for the pool
104: * <code>poolName</code>
105: *
106: * @param poolName Name of the pool.
107: * @return PoolMonitor interface to monitor the state of the pool
108: * @exception ConnectionPoolException
109: *
110: */
111: public MultiPoolMonitor getMultiPoolMonitor(String poolName)
112: throws ConnectionPoolException;
113:
114: /**
115: * This method shutsdown all the pools
116: */
117: public void shutDown();
118:
119: }
|