/* JFox, the OpenSource J2EE Application Server
 *
 * Copyright (C) 2002 huihoo.com
 * Distributable under GNU LGPL license
 * See the GNU Lesser General Public License for more details.
 */

package org.huihoo.jfox.pool.connection;

import java.sql.Connection;

import org.huihoo.jfox.pool.ObjectPool;
import org.huihoo.jfox.pool.PoolableObject;

/**
 * 
 * @author <a href="mailto:kelvin_wym@hotmail.com">Kelvin Wu</a>
 */


public interface PoolableConnection extends PoolableObject{
  /**
   * Get the pool that this poolableConnection belongs to,
   * so the poolableConnection can be managed by the pool.
   */
  ObjectPool getPool();

  /**
   * Set which pool that this PoolableConnection belongs to.
   * @param pool
   */
  void setPool(ObjectPool pool);

  /**
   * Close the physical connection that this PoolableConnection wrapped.
   */
  void reallyClose();

  void setUsing(boolean b);
  boolean isUsing();

  /**
   * get the physical connection
   * @return
   */
  Connection getConnection();

  // override java.sql.Connection.close() method
  void close();
}
