src/share/classes/javax/sql/PooledConnection.java

Print this page




  85  * the underlying prepared statement is recycled rather than being closed.
  86  * <P>
  87  *
  88  * @since 1.4
  89  */
  90 
  91 public interface PooledConnection {
  92 
  93   /**
  94    * Creates and returns a <code>Connection</code> object that is a handle
  95    * for the physical connection that
  96    * this <code>PooledConnection</code> object represents.
  97    * The connection pool manager calls this method when an application has
  98    * called the method <code>DataSource.getConnection</code> and there are
  99    * no <code>PooledConnection</code> objects available. See the
 100    * {@link PooledConnection interface description} for more information.
 101    *
 102    * @return  a <code>Connection</code> object that is a handle to
 103    *          this <code>PooledConnection</code> object
 104    * @exception SQLException if a database access error occurs
 105    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
 106    * this method
 107    * @since 1.4
 108    */
 109   Connection getConnection() throws SQLException;
 110 
 111   /**
 112    * Closes the physical connection that this <code>PooledConnection</code>
 113    * object represents.  An application never calls this method directly;
 114    * it is called by the connection pool module, or manager.
 115    * <P>
 116    * See the {@link PooledConnection interface description} for more
 117    * information.
 118    *
 119    * @exception SQLException if a database access error occurs
 120    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
 121    * this method
 122    * @since 1.4
 123    */
 124   void close() throws SQLException;
 125 
 126   /**
 127    * Registers the given event listener so that it will be notified
 128    * when an event occurs on this <code>PooledConnection</code> object.
 129    *
 130    * @param listener a component, usually the connection pool manager,
 131    *        that has implemented the
 132    *        <code>ConnectionEventListener</code> interface and wants to be
 133    *        notified when the connection is closed or has an error
 134    * @see #removeConnectionEventListener
 135    */
 136   void addConnectionEventListener(ConnectionEventListener listener);
 137 
 138   /**
 139    * Removes the given event listener from the list of components that
 140    * will be notified when an event occurs on this




  85  * the underlying prepared statement is recycled rather than being closed.
  86  * <P>
  87  *
  88  * @since 1.4
  89  */
  90 
  91 public interface PooledConnection {
  92 
  93   /**
  94    * Creates and returns a <code>Connection</code> object that is a handle
  95    * for the physical connection that
  96    * this <code>PooledConnection</code> object represents.
  97    * The connection pool manager calls this method when an application has
  98    * called the method <code>DataSource.getConnection</code> and there are
  99    * no <code>PooledConnection</code> objects available. See the
 100    * {@link PooledConnection interface description} for more information.
 101    *
 102    * @return  a <code>Connection</code> object that is a handle to
 103    *          this <code>PooledConnection</code> object
 104    * @exception SQLException if a database access error occurs
 105    * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support
 106    * this method
 107    * @since 1.4
 108    */
 109   Connection getConnection() throws SQLException;
 110 
 111   /**
 112    * Closes the physical connection that this <code>PooledConnection</code>
 113    * object represents.  An application never calls this method directly;
 114    * it is called by the connection pool module, or manager.
 115    * <P>
 116    * See the {@link PooledConnection interface description} for more
 117    * information.
 118    *
 119    * @exception SQLException if a database access error occurs
 120    * @exception java.sql.SQLFeatureNotSupportedException if the JDBC driver does not support
 121    * this method
 122    * @since 1.4
 123    */
 124   void close() throws SQLException;
 125 
 126   /**
 127    * Registers the given event listener so that it will be notified
 128    * when an event occurs on this <code>PooledConnection</code> object.
 129    *
 130    * @param listener a component, usually the connection pool manager,
 131    *        that has implemented the
 132    *        <code>ConnectionEventListener</code> interface and wants to be
 133    *        notified when the connection is closed or has an error
 134    * @see #removeConnectionEventListener
 135    */
 136   void addConnectionEventListener(ConnectionEventListener listener);
 137 
 138   /**
 139    * Removes the given event listener from the list of components that
 140    * will be notified when an event occurs on this