KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > ejb > MDBObjectFactory


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.ejb;
8
9 import javax.ejb.MessageDrivenBean JavaDoc;
10
11 import org.jfox.pool.PoolableObject;
12
13 /**
14  * 用来给 MDBObjectPool 创建 MDB 实例
15  * @author <a HREF="mailto:young_yy@hotmail.com">Young Yang</a>
16  */

17
18 public class MDBObjectFactory extends EJBObjectFactory {
19
20     public MDBObjectFactory(Class JavaDoc classType,Bucket bucket) throws Exception JavaDoc {
21         super(classType, bucket);
22     }
23
24     // the object maybe have invoked ejbCreate, if so, must call ejbRemove
25
public void destroyObject(PoolableObject object) throws Exception JavaDoc {
26         super.destroyObject(object);
27         // if the poolable object has called the ejbCreate
28
if(((StatelessPoolableObject) object).isEjbCreated()) {
29             getBucket().ejbRemove((MessageDrivenBean JavaDoc) ((MDBPoolableObject) object).getBeanInstance());
30         }
31     }
32
33     public static void main(String JavaDoc[] args) {
34
35     }
36 }
Popular Tags