KickJava   Java API By Example, From Geeks To Geeks.

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


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.SessionBean JavaDoc;
10
11 import org.jfox.pool.PoolableObject;
12
13 /**
14  * @author <a HREF="mailto:young_yy@hotmail.com">Young Yang</a>
15  */

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