/* 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.jfox.jdbc.xa;

import org.huihoo.jfox.pool.ObjectFactory;
import org.huihoo.jfox.pool.PoolableObject;
import org.huihoo.jfox.pool.SimpleObjectPool;

/**
 * 
 * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
 */

public class XAConnectionPool extends  SimpleObjectPool {

  public XAConnectionPool(ObjectFactory factory) {
    super((XAConnectionFactory)factory);
    ((XAConnectionFactory)factory).setPool(this);
  }

  public XAConnectionPool(ObjectFactory factory, int initNum, int maxRest) {
    super(factory, initNum, maxRest);
    ((XAConnectionFactory)factory).setPool(this);
  }

  /**
   * 通过与 XADataSource 默认不同的 user/password 来 getXAConnection
   * 这个 XAConnection 将不缓存
   * @param user
   * @param password
   * @return
   * @throws Exception
   */
  PoolableObject retrieveObject(String user, String password) throws Exception {
    return ((XAConnectionFactory)factory).makeObject(user,password);
  }

  public static void main(String[] args) {

  }
}