1 6 7 package org.jfox.ejb.handler; 8 9 import java.util.Iterator ; 10 import javax.ejb.EnterpriseBean ; 11 12 import org.jfox.ejb.Bucket; 13 import org.jfox.ejb.EJBObjectMethod; 14 import org.jfox.ejb.EJBPoolableObject; 15 import org.jfox.ejb.connector.EJBInvocation; 16 17 24 25 public class A5_InstancePoolHandler extends AbstractHandler { 26 27 public Object invokeBean(Bucket bucket, EJBInvocation invocation, Iterator iter) throws Exception { 28 EJBPoolableObject pobj = bucket.retrieveBean(invocation.getObjectId()); 29 EnterpriseBean bean = pobj.getBeanInstance(); 30 invocation.setBean(bean); 31 32 35 if(invocation.getMethod().equals(EJBObjectMethod.Remove)) { 36 bucket.remove(bean); 37 pobj = null; 38 return null; 39 } 40 41 try { 42 return super.invokeBean(bucket, invocation, iter); 43 } 44 finally { 45 bucket.restoreBean(invocation.getObjectId(), pobj); 46 } 47 48 } 49 50 public static void main(String [] args) { 51 52 } 53 } | Popular Tags |