org.firebirdsql.ds
Class AbstractPooledConnection

java.lang.Object
  extended by org.firebirdsql.ds.AbstractPooledConnection
All Implemented Interfaces:
javax.sql.PooledConnection
Direct Known Subclasses:
FBPooledConnection

public abstract class AbstractPooledConnection
extends java.lang.Object
implements javax.sql.PooledConnection

PooledConnection implementation for FBConnectionPoolDataSource

This class is abstract to account for both a JDBC 3.0 and JDBC 4.0 compliant implementation.

Since:
2.2
Author:
Mark Rotteveel

Field Summary
protected  java.sql.Connection connection
           
protected  org.firebirdsql.ds.PooledConnectionHandler handler
           
 
Constructor Summary
protected AbstractPooledConnection(java.sql.Connection connection)
           
 
Method Summary
 void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
           
 void close()
           
protected  org.firebirdsql.ds.PooledConnectionHandler createConnectionHandler()
          Creates the PooledConnectionHandler for the connection.
protected  void fireConnectionClosed()
          Helper method to fire the connectionClosed event.
protected  void fireConnectionError(java.sql.SQLException ex)
          Helper method to fire the connectionErrorOccurred event.
protected  void fireFatalConnectionError(java.sql.SQLException ex)
          Helper method to fire the connectionErrorOccurred event.
 java.sql.Connection getConnection()
           
protected  void releaseConnectionHandler(org.firebirdsql.ds.PooledConnectionHandler pch)
          Releases the current handler if it is equal to the handler passed in pch.
 void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
           
protected  void resetConnection()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.sql.PooledConnection
addStatementEventListener, removeStatementEventListener
 

Field Detail

connection

protected java.sql.Connection connection

handler

protected volatile org.firebirdsql.ds.PooledConnectionHandler handler
Constructor Detail

AbstractPooledConnection

protected AbstractPooledConnection(java.sql.Connection connection)
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Specified by:
getConnection in interface javax.sql.PooledConnection
Throws:
java.sql.SQLException

resetConnection

protected void resetConnection()
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

createConnectionHandler

protected org.firebirdsql.ds.PooledConnectionHandler createConnectionHandler()
Creates the PooledConnectionHandler for the connection.

Subclasses may override this method to return their own subclass of PooledConnectionHandler.

Returns:
PooledConnectionHandler

close

public void close()
           throws java.sql.SQLException
Specified by:
close in interface javax.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 in pch.

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:
addConnectionEventListener in interface javax.sql.PooledConnection

removeConnectionEventListener

public void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
Specified by:
removeConnectionEventListener in interface javax.sql.PooledConnection


Copyright © 2001-2019 Jaybird (Firebird JDBC/JCA) team. All rights reserved.