avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/lifecycle LifecycleHelper.java
Date Sun, 19 May 2002 02:54:36 GMT
donaldp     02/05/18 19:54:36

  Modified:    src/java/org/apache/avalon/phoenix/components/application
                        AppLifecycleHelper.java
               src/java/org/apache/avalon/phoenix/components/lifecycle
                        LifecycleHelper.java
  Log:
  Move responsibility of maintaining state of entry back to the application
  and out of the helper.
  
  Revision  Changes    Path
  1.5       +18 -5     jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/application/AppLifecycleHelper.java
  
  Index: AppLifecycleHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/application/AppLifecycleHelper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AppLifecycleHelper.java	19 May 2002 02:46:43 -0000	1.4
  +++ AppLifecycleHelper.java	19 May 2002 02:54:36 -0000	1.5
  @@ -148,13 +148,25 @@
       public void startup( final BlockEntry entry )
           throws Exception
       {
  -        final Object block =
  -            m_lifecycleHelper.startup( entry, m_blockAccessor );
  +        State state = State.FAILED;
  +        try
  +        {
  +            entry.setState( State.STARTING );
   
  -        m_exportHelper.exportBlock( m_context, entry.getMetaData(), block );
  +            final Object block =
  +                m_lifecycleHelper.startup( entry, m_blockAccessor );
   
  -        entry.setObject( block );
  -        m_listenerSupport.fireBlockAddedEvent( entry );
  +            m_exportHelper.exportBlock( m_context, entry.getMetaData(), block );
  +
  +            state = State.STARTED;
  +            entry.setObject( block );
  +
  +            m_listenerSupport.fireBlockAddedEvent( entry );
  +        }
  +        finally
  +        {
  +            entry.setState( state );
  +        }
       }
   
       /**
  @@ -168,6 +180,7 @@
        */
       public void shutdown( final BlockEntry entry )
       {
  +        entry.setState( State.DESTROYING );
           m_listenerSupport.fireBlockRemovedEvent( entry );
   
           //Remove block from Management system
  
  
  
  1.5       +0 -12     jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/lifecycle/LifecycleHelper.java
  
  Index: LifecycleHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/lifecycle/LifecycleHelper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LifecycleHelper.java	19 May 2002 02:17:27 -0000	1.4
  +++ LifecycleHelper.java	19 May 2002 02:54:36 -0000	1.5
  @@ -78,14 +78,10 @@
           int stage = 0;
           try
           {
  -            entry.setState( State.CREATING );
               //Creation stage
               stage = STAGE_CREATE;
               notice( name, stage );
               final Object object = accessor.createObject( entry );
  -            entry.setState( State.CREATED );
  -
  -            entry.setState( State.STARTING );
   
               //LogEnabled stage
               stage = STAGE_LOGGER;
  @@ -158,12 +154,10 @@
                   ContainerUtil.start( object );
               }
   
  -            entry.setState( State.STARTED );
               return object;
           }
           catch( final Throwable t )
           {
  -            entry.setState( State.FAILED );
               fail( name, stage, t );
   
               //fail() throws an exception so next
  @@ -193,13 +187,10 @@
               notice( name, STAGE_STOP );
               try
               {
  -                entry.setState( State.STOPPING );
                   ContainerUtil.stop( object );
  -                entry.setState( State.STOPPED );
               }
               catch( final Throwable t )
               {
  -                entry.setState( State.FAILED );
                   safeFail( name, STAGE_STOP, t );
               }
           }
  @@ -210,18 +201,15 @@
               notice( name, STAGE_DISPOSE );
               try
               {
  -                entry.setState( State.DESTROYING );
                   ContainerUtil.dispose( object );
               }
               catch( final Throwable t )
               {
  -                entry.setState( State.FAILED );
                   safeFail( name, STAGE_DISPOSE, t );
               }
           }
   
           notice( name, STAGE_DESTROY );
  -        entry.setState( State.DESTROYED );
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message