proyal      2002/06/27 21:43:47

  Modified:    fortress/src/java/org/apache/excalibur/fortress/util
                        ContextManager.java
  Log:
  Don't create empty ServiceManager's or ComponentManager's if not needed.
  
  Revision  Changes    Path
  1.23      +17 -9     
jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/util/ContextManager.java
  
  Index: ContextManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/fortress/src/java/org/apache/excalibur/fortress/util/ContextManager.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ContextManager.java       27 Jun 2002 16:48:36 -0000      1.22
  +++ ContextManager.java       28 Jun 2002 04:43:47 -0000      1.23
  @@ -293,10 +293,14 @@
           //
           // No, if there is no parent CM, then there is no parent Container.  
Therefore, there is
           // no need for a new CM here.  -BL
  -        ComponentManager cm = new DefaultComponentManager(
  -            (ComponentManager)get( rootContext, COMPONENT_MANAGER_PARENT, 
null ) );
  -        assumeOwnership( cm );
  -        containerManagerContext.put( COMPONENT_MANAGER, cm );
  +        final ComponentManager parent = (ComponentManager)get( rootContext, 
COMPONENT_MANAGER_PARENT, null );
  +
  +        if( null != parent ) //Don't waste time if we don't have a parent
  +        {
  +            ComponentManager cm = new DefaultComponentManager( parent );
  +            assumeOwnership( cm );
  +            containerManagerContext.put( COMPONENT_MANAGER, cm );
  +        }
       }
   
       /**
  @@ -329,10 +333,14 @@
               // No ComponentLocator available anywhere. (Set one up.)
           }
   
  -        ServiceManager sm = new DefaultServiceManager(
  -            (ServiceManager)get( rootContext, SERVICE_MANAGER_PARENT, null ) 
);
  -        assumeOwnership( sm );
  -        containerManagerContext.put( SERVICE_MANAGER, sm );
  +        final ServiceManager parent = (ServiceManager)get( rootContext, 
SERVICE_MANAGER_PARENT, null );
  +
  +        if( null != parent )
  +        {
  +            ServiceManager sm = new DefaultServiceManager( parent );
  +            assumeOwnership( sm );
  +            containerManagerContext.put( SERVICE_MANAGER, sm );
  +        }
       }
        
       protected void initializeCommandQueue() throws Exception
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to