org.postgresql.ds.jdbc23
Class AbstractJdbc23PooledConnection

java.lang.Object
  extended by org.postgresql.ds.jdbc23.AbstractJdbc23PooledConnection
Direct Known Subclasses:
AbstractJdbc4PooledConnection

public abstract class AbstractJdbc23PooledConnection
extends Object

PostgreSQL implementation of the PooledConnection interface. This shouldn't be used directly, as the pooling client should just interact with the ConnectionPool instead.

Author:
Aaron Mulder (ammulder@chariotsolutions.com), Csaba Nagy (ncsaba@yahoo.com)
See Also:
PGConnectionPoolDataSource

Constructor Summary
AbstractJdbc23PooledConnection(Connection con, boolean autoCommit, boolean isXA)
          Creates a new PooledConnection representing the specified physical connection.
 
Method Summary
 void addConnectionEventListener(ConnectionEventListener connectionEventListener)
          Adds a listener for close or fatal error events on the connection handed out to a client.
 void close()
          Closes the physical database connection represented by this PooledConnection.
protected abstract  ConnectionEvent createConnectionEvent(SQLException e)
           
 Connection getConnection()
          Gets a handle for a client to use.
 void removeConnectionEventListener(ConnectionEventListener connectionEventListener)
          Removes a listener for close or fatal error events on the connection handed out to a client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractJdbc23PooledConnection

public AbstractJdbc23PooledConnection(Connection con,
                                      boolean autoCommit,
                                      boolean isXA)
Creates a new PooledConnection representing the specified physical connection.

Method Detail

addConnectionEventListener

public void addConnectionEventListener(ConnectionEventListener connectionEventListener)
Adds a listener for close or fatal error events on the connection handed out to a client.


removeConnectionEventListener

public void removeConnectionEventListener(ConnectionEventListener connectionEventListener)
Removes a listener for close or fatal error events on the connection handed out to a client.


close

public void close()
           throws SQLException
Closes the physical database connection represented by this PooledConnection. If any client has a connection based on this PooledConnection, it is forcibly closed as well.

Throws:
SQLException

getConnection

public Connection getConnection()
                         throws SQLException
Gets a handle for a client to use. This is a wrapper around the physical connection, so the client can call close and it will just return the connection to the pool without really closing the pgysical connection.

According to the JDBC 2.0 Optional Package spec (6.2.3), only one client may have an active handle to the connection at a time, so if there is a previous handle active when this is called, the previous one is forcibly closed and its work rolled back.

Throws:
SQLException

createConnectionEvent

protected abstract ConnectionEvent createConnectionEvent(SQLException e)


Copyright © 2013. All Rights Reserved.