Package org.firebirdsql.ds
Class FBPooledConnection
- java.lang.Object
-
- org.firebirdsql.ds.FBPooledConnection
-
- All Implemented Interfaces:
javax.sql.PooledConnection
- Direct Known Subclasses:
FBXAConnection
public class FBPooledConnection extends java.lang.Object implements javax.sql.PooledConnectionPooledConnection implementation forFBConnectionPoolDataSource- Since:
- 2.2
- Author:
- Mark Rotteveel
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedFBPooledConnection(java.sql.Connection connection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnectionEventListener(javax.sql.ConnectionEventListener listener)voidaddStatementEventListener(javax.sql.StatementEventListener listener)voidclose()protected org.firebirdsql.ds.PooledConnectionHandlercreateConnectionHandler(java.sql.Connection connection)Creates the PooledConnectionHandler for the connection.protected voidfireConnectionClosed()Helper method to fire the connectionClosed event.protected voidfireConnectionError(java.sql.SQLException ex)Helper method to fire the connectionErrorOccurred event.protected voidfireFatalConnectionError(java.sql.SQLException ex)Helper method to fire the connectionErrorOccurred event.java.sql.ConnectiongetConnection()protected voidreleaseConnectionHandler(org.firebirdsql.ds.PooledConnectionHandler pch)Releases the current handler if it is equal to the handler passed inpch.voidremoveConnectionEventListener(javax.sql.ConnectionEventListener listener)voidremoveStatementEventListener(javax.sql.StatementEventListener listener)protected voidresetConnection(java.sql.Connection connection)protected LockCloseablewithLock()
-
-
-
Method Detail
-
withLock
protected LockCloseable withLock()
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException- Specified by:
getConnectionin interfacejavax.sql.PooledConnection- Throws:
java.sql.SQLException
-
resetConnection
protected void resetConnection(java.sql.Connection connection) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
createConnectionHandler
protected org.firebirdsql.ds.PooledConnectionHandler createConnectionHandler(java.sql.Connection connection)
Creates the PooledConnectionHandler for the connection.Subclasses may override this method to return their own subclass of PooledConnectionHandler.
- Parameters:
connection- Connection- Returns:
- PooledConnectionHandler
-
close
public void close() throws java.sql.SQLException- Specified by:
closein interfacejavax.sql.PooledConnection- Throws:
java.sql.SQLException
-
fireFatalConnectionError
protected void fireFatalConnectionError(java.sql.SQLException ex)
Helper method to fire the connectionErrorOccurred event. To be used with fatal (connection) errors only.- Parameters:
ex- The exception
-
fireConnectionError
protected void fireConnectionError(java.sql.SQLException ex)
Helper method to fire the connectionErrorOccurred event.This method will decide which errors warrant a connectionErrorOccurred event to be reported or not.
- Parameters:
ex- The exception
-
fireConnectionClosed
protected void fireConnectionClosed()
Helper method to fire the connectionClosed event.
-
releaseConnectionHandler
protected void releaseConnectionHandler(org.firebirdsql.ds.PooledConnectionHandler pch)
Releases the current handler if it is equal to the handler passed inpch.To be called by the PooledConnectionHandler when it has been closed.
- Parameters:
pch- PooledConnectionHandler to release.
-
addConnectionEventListener
public void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
- Specified by:
addConnectionEventListenerin interfacejavax.sql.PooledConnection
-
removeConnectionEventListener
public void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
- Specified by:
removeConnectionEventListenerin interfacejavax.sql.PooledConnection
-
addStatementEventListener
public void addStatementEventListener(javax.sql.StatementEventListener listener)
- Specified by:
addStatementEventListenerin interfacejavax.sql.PooledConnection
-
removeStatementEventListener
public void removeStatementEventListener(javax.sql.StatementEventListener listener)
- Specified by:
removeStatementEventListenerin interfacejavax.sql.PooledConnection
-
-