|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jtools.jpool.system.Pool
Pool Class The pool class contains a collection of connection to the database as specified in the configuration object. You can retrieved pooled connections and return them in order for other user to use these connections. Additionally you can request for current pool information as also the configuration values.
$Id: Pool.java,v 1.1 2003/10/15 15:37:31 stfndln Exp $
Constructor Summary | |
Pool(PoolConfig _config)
Constructs the pool based up the given configuration object |
Method Summary | |
protected java.sql.Connection |
createConnection()
Creates a new connection as specified with the values in the configuration object. |
PoolConfig |
getConfig()
Retrieves the configuration object for this pool object |
java.sql.Connection |
getConnection()
Retrieves a connection from this pool which you can use as you need it. |
int |
getNumberFreeConnections()
Retrieves the number of free connections |
int |
getNumberUsedConnections()
Retrieves the number of used connections. |
protected java.sql.Connection |
getPooledConnection()
Retrieves a pooled connection and checks if the connection is still within the limit of the maximum defined number of connections. |
java.lang.String |
getStats()
Returns a string value with the current statistics of the pool. |
protected void |
initialize()
Initializes the pool. |
protected boolean |
isConnectionExpired(java.sql.Connection _conn)
Checks if a connection is expired or not based upon the expire value in the configuration object. |
protected java.sql.Connection |
retrieveConnection(long _timeout)
Tries to retrieves a connection from the pool but the given timeout may not be exceded. |
boolean |
returnConnection(java.sql.Connection _conn)
Returns a requested pool connection to the pool and makes it available again for request. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Pool(PoolConfig _config)
_config
- Configuration object to initialize the poolMethod Detail |
protected void initialize() throws java.sql.SQLException
java.sql.SQLException
- failed to initialize the pool objectprotected java.sql.Connection createConnection() throws java.sql.SQLException
java.sql.SQLException
- thrown when failed to create a new connectionpublic java.sql.Connection getConnection() throws java.sql.SQLException
java.sql.SQLException
- thrown when failed to get a pooled connectionprotected java.sql.Connection retrieveConnection(long _timeout) throws java.sql.SQLException
_timeout
- The maximum time to try and get a pooled connection
java.sql.SQLException
- thrown when failed to retrieve a pooled connectionprotected java.sql.Connection getPooledConnection() throws java.sql.SQLException
java.sql.SQLException
- thrown when retrieval of a pooled connection failsprotected boolean isConnectionExpired(java.sql.Connection _conn) throws java.sql.SQLException
_conn
- The connection to check for expiration
java.sql.SQLException
- thrown when an error occurs during the checkpublic boolean returnConnection(java.sql.Connection _conn)
_conn
- The connection to return to the pool
public int getNumberUsedConnections()
public int getNumberFreeConnections()
public PoolConfig getConfig()
public java.lang.String getStats()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |