donaldp     2002/08/01 21:14:47

  Modified:    containerkit/src/java/org/apache/excalibur/containerkit/kernel
                        AbstractServiceKernel.java
  Log:
  During component processing phase you should process all
  components in list rather than stopping at first one that
  indicates failure. This is to make sure that as many resources
  as possible are shutdown.
  
  Revision  Changes    Path
  1.17      +27 -7     
jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/kernel/AbstractServiceKernel.java
  
  Index: AbstractServiceKernel.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/kernel/AbstractServiceKernel.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- AbstractServiceKernel.java        2 Aug 2002 03:52:07 -0000       1.16
  +++ AbstractServiceKernel.java        2 Aug 2002 04:14:46 -0000       1.17
  @@ -14,8 +14,8 @@
   import org.apache.avalon.excalibur.i18n.Resources;
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.avalon.framework.activity.Initializable;
  -import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.container.ContainerUtil;
  +import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.excalibur.containerkit.dependency.DependencyMap;
   import org.apache.excalibur.containerkit.lifecycle.LifecycleHelper;
   import org.apache.excalibur.containerkit.lifecycle.ResourceProvider;
  @@ -36,24 +36,20 @@
   {
       private final static Resources REZ =
           ResourceManager.getPackageResources( AbstractServiceKernel.class );
  -
       /**
        * The resource provider to use to provide resources
        * for all the components.
        */
       private ResourceProvider m_resourceProvider;
  -
       /**
        * The component that is responsible for running components
        * through their lifecycle stages.
        */
       private LifecycleHelper m_lifecycleHelper;
  -
       /**
        * The map of all entrys present in application.
        */
       private final HashMap m_entrys = new HashMap();
  -
       /**
        * The {@link DependencyMap} via which dependency graph is
        * produced.
  @@ -206,9 +202,33 @@
       {
           processComponentsNotice( components, startup );
   
  +        Exception exception = null;
           for( int i = 0; i < components.length; i++ )
           {
  -            processComponent( components[ i ], startup );
  +            try
  +            {
  +                processComponent( components[ i ], startup );
  +            }
  +            catch( final Exception e )
  +            {
  +                //during startup we should fail immediately
  +                //while during shutdown of component you need to shutdown
  +                //all components regardless of whether some of them don't
  +                //shutdown cleanly
  +                if( startup )
  +                {
  +                    throw e;
  +                }
  +                else
  +                {
  +                    exception = e;
  +                }
  +            }
  +        }
  +
  +        if( null != exception )
  +        {
  +            throw exception;
           }
       }
   
  
  
  

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

Reply via email to