|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jfw.database.ConnectionPool
public final class ConnectionPool
Manage a connection pool.
Initialy is opened a number the number of connections defined by key
cp_max_connections_db-name of jfw.properties. If more connections
are requested then the pool open them when is needed and close them when is
released.
For get a conection pool the class ConnectionPoolProxy
must be used.
A thread of this class, created in the constructor, is be used for clean
connections blocked for a time or closed. The key cp_dbclean_maxtime_db-name
of jfw.properties is used for define the max time before to close a
blocked connection.
Is an observer of UpdateObservable
.
Method Summary | |
---|---|
boolean |
exit()
Close all opened connections, permanent and temporary. |
protected void |
finalize()
Call super.finalize() and exit() . |
java.sql.Connection |
getConnection()
Return a free permanent connection. |
boolean |
isClosed(java.sql.Connection connection)
Check the status of a connection. |
void |
releaseConnection(java.sql.Connection thisConnection)
Release a connection. |
void |
run()
The thread that clean the connections. |
java.util.ArrayList |
status()
Return detail infos of the connection pool. |
java.lang.String |
toString()
Return log informations relative to the connection pool. |
void |
update(java.util.Observable o,
java.lang.Object arg)
Called by UpdateObservable . |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public java.sql.Connection getConnection() throws DatabaseException
DatabaseException
public void releaseConnection(java.sql.Connection thisConnection)
thisConnection
- the Connection object to release.public boolean isClosed(java.sql.Connection connection)
connection
- the Connection to check.
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.ArrayList status()
connectionHash
tempConnectionHash
infoHash
public boolean exit()
protected void finalize() throws java.lang.Throwable
exit()
.
finalize
in class java.lang.Object
java.lang.Throwable
public void run()
run
in interface java.lang.Runnable
public void update(java.util.Observable o, java.lang.Object arg)
UpdateObservable
.
The initialize()
method is called.
update
in interface java.util.Observer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |