Class JDBCPooledConnection
java.lang.Object
org.hsqldb.jdbc.pool.JDBCPooledConnection
- All Implemented Interfaces:
PooledConnection, JDBCConnectionEventListener
- Direct Known Subclasses:
JDBCXAConnection
public class JDBCPooledConnection
extends Object
implements PooledConnection, JDBCConnectionEventListener
An implementations of
PooledConnection
for use by connection pooling software.The class maintains a lifetime connection to the database. The getConnection() method establishes a lease on the lifetime connection and returns a special JDBCConnection (userConnection) that is valid until it is closed.
This class uses a dedicated HyperSQL method to guarantee each lease on the connection starts with the original state of the connection.
The ConnectionEventLister objects that have been registered with this PooledConnection are notified when each lease expires, or an unrecoverable error occurs on the connection to the database.
- Since:
- JDK 1.2, HSQLDB 2.0
- Author:
- Fred Toussi (fredt@users dot sourceforge.net)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidclose()voidvoidbooleanisInUse()Returns true if getConnection() has been called and a leas has been given.voidrelease()Force close the userConnection, and connection, no close event is fired.voidvoidvoidreset()Force close the userConnection, no close event is fired.
-
Constructor Details
-
JDBCPooledConnection
-
-
Method Details
-
getConnection
- Specified by:
getConnectionin interfacePooledConnection- Throws:
SQLException
-
close
- Specified by:
closein interfacePooledConnection- Throws:
SQLException
-
addConnectionEventListener
- Specified by:
addConnectionEventListenerin interfacePooledConnection
-
removeConnectionEventListener
- Specified by:
removeConnectionEventListenerin interfacePooledConnection
-
addStatementEventListener
- Specified by:
addStatementEventListenerin interfacePooledConnection
-
removeStatementEventListener
- Specified by:
removeStatementEventListenerin interfacePooledConnection
-
connectionClosed
public void connectionClosed()- Specified by:
connectionClosedin interfaceJDBCConnectionEventListener
-
connectionErrorOccurred
- Specified by:
connectionErrorOccurredin interfaceJDBCConnectionEventListener
-
isInUse
public boolean isInUse()Returns true if getConnection() has been called and a leas has been given.- Returns:
- boolean
-
reset
public void reset()Force close the userConnection, no close event is fired. -
release
public void release()Force close the userConnection, and connection, no close event is fired.
-