1 22 package org.jboss.test.jbossmx.implementation.server.support; 23 24 import java.io.IOException ; 25 import java.io.*; 26 import java.rmi.MarshalledObject ; 27 28 import org.jboss.logging.Logger; 29 30 35 public class ContextCL implements ContextCLMBean 36 { 37 private static Logger log = Logger.getLogger(ContextCL.class); 38 private TestData data0; 39 40 44 public ContextCL() throws IOException 45 { 46 ClassLoader cl = Thread.currentThread().getContextClassLoader(); 47 log.info("ContextCL ClassLoader: "+getClass().getClassLoader()); 48 log.info("ctor Context ClassLoader: "+cl); 49 data0 = new TestData(); 50 log.info("TestData.class ProtectionDomain: "+TestData.class.getProtectionDomain()); 51 } 52 53 58 public void useTestData() throws Exception 59 { 60 ClassLoader cl = Thread.currentThread().getContextClassLoader(); 61 log.info("useTestData ClassLoader: "+cl); 62 Class c0 = data0.getClass(); 63 log.info("TestData #0 ProtectionDomain: "+c0.getProtectionDomain()); 64 Class c1 = Class.forName("org.jboss.test.jbossmx.implementation.server.support.TestData", 65 false, cl); 66 log.info("TestData #1 ProtectionDomain: "+c1.getProtectionDomain()); 67 if( c1.isInstance(data0) == false ) 68 { 69 log.error("Assertion failed: data0 is NOT compatible with c1"); 70 throw new IllegalStateException ("data0 is NOT compatible with c1"); 71 } 72 } 73 } 74 | Popular Tags |