1 package org.jfox.ejb.handler; 2 3 import java.util.Iterator ; 4 5 import org.jfox.ejb.Bucket; 6 import org.jfox.ejb.connector.EJBInvocation; 7 8 17 18 public class A0_ThreadContextHandler extends AbstractHandler { 19 20 public Object invokeHome(Bucket bucket, EJBInvocation invocation, Iterator iter) throws Exception { 21 ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); 22 Thread.currentThread().setContextClassLoader(bucket.getEJBClassLoader()); 23 24 try { 25 return super.invokeHome(bucket, invocation, iter); 26 } 27 finally { 28 Thread.currentThread().setContextClassLoader(oldLoader); 29 } 30 } 31 32 public Object invokeBean(Bucket bucket, EJBInvocation invocation, Iterator iter) throws Exception { 33 ClassLoader oldLoader = Thread.currentThread().getContextClassLoader(); 34 Thread.currentThread().setContextClassLoader(bucket.getEJBClassLoader()); 35 try { 36 return super.invokeBean(bucket, invocation, iter); 37 } 38 finally { 39 Thread.currentThread().setContextClassLoader(oldLoader); 40 } 41 42 } 43 44 public static void main(String [] args) { 45 46 } 47 } 48 49 | Popular Tags |