KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > jdbc > xa > XAConnectionPool


1 /* JFox, the OpenSource J2EE Application Server
2  *
3  * Distributable under GNU LGPL license by gun.org
4  * more details please visit http://www.huihoo.org/jfox
5  */

6
7 package org.jfox.jdbc.xa;
8
9 import org.jfox.pool.ObjectFactory;
10 import org.jfox.pool.PoolableObject;
11 import org.jfox.pool.SimpleObjectPool;
12
13 /**
14  * @author <a HREF="mailto:young_yy@hotmail.com">Young Yang</a>
15  */

16
17 public class XAConnectionPool extends SimpleObjectPool {
18
19     public XAConnectionPool(ObjectFactory factory) {
20         super((XAConnectionFactory) factory);
21         ((XAConnectionFactory) factory).setPool(this);
22     }
23
24     public XAConnectionPool(ObjectFactory factory, int initNum, int maxRest) {
25         super(factory, initNum, maxRest);
26         ((XAConnectionFactory) factory).setPool(this);
27     }
28
29     public XAConnectionPool(ObjectFactory factory, int initNum, int maxRest, long timeout) {
30         super(factory, initNum, maxRest, timeout);
31     }
32
33     /**
34      * 通过与 XADataSource 默认不同的 user/password 来 getXAConnection
35      * 这个 XAConnection 将不缓存
36      *
37      * @param user
38      * @param password
39      * @return
40      * @throws Exception
41      */

42     PoolableObject retrieveObject(String JavaDoc user, String JavaDoc password) throws Exception JavaDoc {
43         return ((XAConnectionFactory) factory).makeObject(user, password);
44     }
45
46     public static void main(String JavaDoc[] args) {
47
48     }
49 }
Popular Tags