FileDocCategorySizeDatePackage
ThreadLocalENCFactory.javaAPI DocJBoss 4.2.13140Fri Jul 13 20:53:58 BST 2007org.jboss.ejb3

ThreadLocalENCFactory

public class ThreadLocalENCFactory extends Object implements ObjectFactory
Implementation of "java:comp" namespace factory. The context is associated with the thread class loader.
author
Bill Burke
version
$Revision: 60420 $

Fields Summary
private static ThreadLocal
enc
private static ThreadLocal
stack
Constructors Summary
Methods Summary
public static javax.naming.Contextcreate(javax.naming.Context parent)


         
   
      NamingServer srv = new NamingServer();
      return new NamingContext(parent.getEnvironment(), null, srv);
   
public java.lang.ObjectgetObjectInstance(java.lang.Object obj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable environment)

      Context ctx = enc.get();
      return ctx;
   
public static voidpop()

      LinkedList<Context> currentStack = stack.get();
      if (currentStack == null)
      {
         enc.set(null);
         return;
      }
      if (currentStack.size() == 0)
      {
         enc.set(null);
         return;
      }
      Context previous = currentStack.removeLast();
      enc.set(previous);
   
public static voidpush(javax.naming.Context ctx)

      if (enc.get() == null)
      {
         enc.set(ctx);
         return;
      }
      LinkedList<Context> currentStack = stack.get();
      if (currentStack == null)
      {
         currentStack = new LinkedList<Context>();
         stack.set(currentStack);
      }
      currentStack.addLast(enc.get());
      enc.set(ctx);