User: starksm 
  Date: 01/09/03 16:00:22

  Modified:    src/main/org/jboss/naming Tag: Branch_2_4 ENCFactory.java
  Log:
  Look for an existing ENC associated with a parent class loader before
  creating a ctxClassLoader ENC
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3.6.1   +22 -7     jboss/src/main/org/jboss/naming/ENCFactory.java
  
  Index: ENCFactory.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/naming/ENCFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.3.6.1
  diff -u -r1.3 -r1.3.6.1
  --- ENCFactory.java   2000/12/07 15:45:09     1.3
  +++ ENCFactory.java   2001/09/03 23:00:22     1.3.6.1
  @@ -22,7 +22,8 @@
    *     
    *   @see <related>
    *   @author Rickard Oberg ([EMAIL PROTECTED])
  - *   @version $Revision: 1.3 $
  + *   @author [EMAIL PROTECTED]
  + *   @version $Revision: 1.3.6.1 $
    */
   public class ENCFactory
      implements ObjectFactory
  @@ -48,18 +49,32 @@
         synchronized (encs)
         {
            // Get naming for this component
  -         NamingServer srv = 
(NamingServer)encs.get(Thread.currentThread().getContextClassLoader());
  -      
  -         // If this is the first time we see this name
  +         ClassLoader ctxClassLoader = 
Thread.currentThread().getContextClassLoader();
  +         NamingServer srv = (NamingServer) encs.get(ctxClassLoader);
  +
  +         /* If this is the first time we see ctxClassLoader first check to see
  +          if a parent ClassLoader has created an ENC namespace.
  +         */
            if (srv == null)
            {
  -            srv = new NamingServer();
  -            encs.put(Thread.currentThread().getContextClassLoader(), srv);
  +            ClassLoader parent = ctxClassLoader.getParent();
  +            while( parent != null && srv == null )
  +            {
  +               parent = parent.getParent();
  +               if( parent != null )
  +                   srv = (NamingServer) encs.get(parent);
  +            }
  +            // If we did not find an ENC create it
  +            if( srv == null )
  +            {
  +               srv = new NamingServer();
  +               encs.put(ctxClassLoader, srv);
  +            }
            }
            return new NamingContext(environment, null, srv);
         }
      }
  -    
  +
      // Y overrides ---------------------------------------------------
   
      // Package protected ---------------------------------------------
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to