FileDocCategorySizeDatePackage
SimpleMultiplexer.javaAPI DocJBoss 4.2.13190Fri Jul 13 20:53:48 BST 2007org.jboss.ejb3.naming

SimpleMultiplexer

public class SimpleMultiplexer extends Object implements ObjectFactory
An object factory which creates a multiplexing context to "comp.ejb3" and "comp.original"
author
Carlo de Wolf
version
$Revision: $

Fields Summary
private static final Logger
log
Constructors Summary
public SimpleMultiplexer()

   
      
   
   
Methods Summary
private javax.naming.ContextcreateMultiplexer(javax.naming.Context ctx)

      Context ctxTwo = (Context) ctx.lookup("comp.ejb3");
      Context ctxOne = (Context) ctx.lookup("comp.original");
      if(log.isTraceEnabled())
      {
         log.trace("contextClassLoader = " + getContextClassLoader() + " ctxOne = " + ctxOne);
      }
      if(ctxTwo == null)
         return ctxOne;
      return new MultiplexerContext(ctxOne, ctxTwo);
   
private static java.lang.ClassLoadergetContextClassLoader()

      if(System.getSecurityManager() == null)
         return Thread.currentThread().getContextClassLoader();
      else
      {
         PrivilegedAction<ClassLoader> action = new PrivilegedAction<ClassLoader>()
         {
            public ClassLoader run()
            {
               return Thread.currentThread().getContextClassLoader();
            }
         };
         return AccessController.doPrivileged(action);
      }
   
public java.lang.ObjectgetObjectInstance(java.lang.Object obj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable environment)

      if(nameCtx == null)
      {
         nameCtx = (Context) new InitialContext().lookup("java:");
         try
         {
            return createMultiplexer(nameCtx);
         }
         finally
         {
            nameCtx.close();
         }
      }
      else
      {
         return createMultiplexer(nameCtx);
      }