[jboss-dev-forums] [Design of EJB 3.0] - Re: EJBTHREE-1396 MockServer must report startup / shutdown

jaikiran do-not-reply at jboss.com
Wed Nov 26 10:09:57 EST 2008


"ALRubinger" wrote : 
  | 
  | * I neglected to provide facility for parent CLs in my Hack CLs that do the jndi.properties replacements. 
  | 
  | * Always reset TCL to the original in a "finally" block.
  | 
  | S,
  | ALR

Andrew,

>From what i see in the code and understand from the comments, the purpose of JndiPropertiesToJndiRemotePropertiesHackCl is to

anonymous wrote : switch requests for  "jndi.properties" to use "jndi-remote.properties"

// Switch up to the hacky CL so that "jndi.properties" is not loaded, and uses instead "jndi-remote.properties"
  |       ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
  |       Thread.currentThread().setContextClassLoader(new JndiPropertiesToJndiRemotePropertiesHackCl());
  | 
  |       RemoteAccessTestCase.setContext(new InitialContext());

Any specific reason for using a different classloader, instead of something like this:

// get the input stream for jndi-remote.properties file, which will be available
  | // in classpath
  | InputStream inputStream = RemoteAccessTestCase.class.getClassLoader().getResourceAsStream("jndi-remote.properties");
  | 
  | // load the jndi-remote.properties 
  | Properties jndiRemoteProperties = new Properties();
  | jndiRemoteProperties.load(inputStream);
  | 
  | // Use the non-default constructor of InitialContext and pass the 
  | // properties
  | RemoteAccessTestCase.setContext(new InitialContext(jndiRemoteProperties));

Am i missing something here (which is very likely)?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4192500#4192500

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4192500



More information about the jboss-dev-forums mailing list