1 22 package org.jboss.ejb3.mdb.inflow; 23 24 import java.security.AccessController ; 25 import java.security.PrivilegedAction ; 26 27 31 public class GetTCLAction implements PrivilegedAction 32 { 33 static PrivilegedAction ACTION = new GetTCLAction(null); 34 Thread t; 35 36 GetTCLAction(Thread t) 37 { 38 this.t = t; 39 } 40 public Object run() 41 { 42 Thread thread = t; 43 if (thread == null) 44 thread = Thread.currentThread(); 45 ClassLoader loader = thread.getContextClassLoader(); 46 return loader; 47 } 48 49 static ClassLoader getContextClassLoader() 50 { 51 ClassLoader loader = (ClassLoader ) AccessController.doPrivileged(ACTION); 52 return loader; 53 } 54 static ClassLoader getContextClassLoader(Thread t) 55 { 56 GetTCLAction action = new GetTCLAction(t); 57 ClassLoader loader = (ClassLoader ) AccessController.doPrivileged(action); 58 return loader; 59 } 60 61 } 62 63 | Popular Tags |