org.apache.cayenne.conn
Class PooledConnectionImpl

java.lang.Object
  extended by org.apache.cayenne.conn.PooledConnectionImpl
All Implemented Interfaces:
javax.sql.PooledConnection

public class PooledConnectionImpl
extends java.lang.Object
implements javax.sql.PooledConnection

PooledConnectionImpl is an implementation of a pooling wrapper for the database connection as per JDBC3 spec. Most of the modern JDBC drivers should have its own implementation that may be used instead of this class.

Author:
Andrei Adamchik

Constructor Summary
protected PooledConnectionImpl()
           
  PooledConnectionImpl(javax.sql.DataSource connectionSource, java.lang.String userName, java.lang.String password)
          Creates new PooledConnection
 
Method Summary
 void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
           
 void close()
           
protected  void connectionClosedNotification()
          Creates and sends an event to listeners when a user closes java.sql.Connection object belonging to this PooledConnection.
 void connectionErrorNotification(java.sql.SQLException exception)
          This method creates and sents an event to listeners when an error occurs in the underlying connection.
 java.sql.Connection getConnection()
           
 void reconnect()
           
 void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
           
protected  void returnConnectionToThePool()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PooledConnectionImpl

protected PooledConnectionImpl()

PooledConnectionImpl

public PooledConnectionImpl(javax.sql.DataSource connectionSource,
                            java.lang.String userName,
                            java.lang.String password)
Creates new PooledConnection

Method Detail

reconnect

public void reconnect()
               throws java.sql.SQLException
Throws:
java.sql.SQLException

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

close

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

getConnection

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

returnConnectionToThePool

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

connectionErrorNotification

public void connectionErrorNotification(java.sql.SQLException exception)
This method creates and sents an event to listeners when an error occurs in the underlying connection. Listeners can have special logic to analyze the error and do things like closing this PooledConnection (if the error is fatal), etc...


connectionClosedNotification

protected void connectionClosedNotification()
Creates and sends an event to listeners when a user closes java.sql.Connection object belonging to this PooledConnection.



Copyright © 2001-2006 Apache.org All Rights Reserved.