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-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/kernel AbstractServiceKernel.java Resources.properties
Date Fri, 02 Aug 2002 03:52:08 GMT
donaldp     2002/08/01 20:52:08

  Modified:    containerkit/src/java/org/apache/excalibur/containerkit/kernel
                        AbstractServiceKernel.java Resources.properties
  Log:
  Shutdown provider and lifecyclehelper in dispose method
  
  Revision  Changes    Path
  1.16      +35 -3     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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- AbstractServiceKernel.java	19 Jul 2002 01:05:22 -0000	1.15
  +++ AbstractServiceKernel.java	2 Aug 2002 03:52:07 -0000	1.16
  @@ -12,8 +12,10 @@
   import java.util.List;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  -import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +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.excalibur.containerkit.dependency.DependencyMap;
   import org.apache.excalibur.containerkit.lifecycle.LifecycleHelper;
   import org.apache.excalibur.containerkit.lifecycle.ResourceProvider;
  @@ -30,7 +32,7 @@
    */
   public abstract class AbstractServiceKernel
       extends AbstractLogEnabled
  -    implements Initializable
  +    implements Initializable, Disposable
   {
       private final static Resources REZ =
           ResourceManager.getPackageResources( AbstractServiceKernel.class );
  @@ -70,6 +72,36 @@
       {
           m_resourceProvider = prepareResourceProvider();
           m_lifecycleHelper = prepareLifecycleHelper();
  +    }
  +
  +    /**
  +     * Dispose the kernel and de-allocate any resources.
  +     * This method will just shutdown and null out the
  +     * {@link ResourceProvider} and {@link LifecycleHelper}
  +     * objects.
  +     */
  +    public void dispose()
  +    {
  +        try
  +        {
  +            ContainerUtil.shutdown( m_resourceProvider );
  +        }
  +        catch( final Exception e )
  +        {
  +            final String message =
  +                REZ.getString( "provider-shutdown.error" );
  +            getLogger().warn( message, e );
  +        }
  +        try
  +        {
  +            ContainerUtil.shutdown( m_lifecycleHelper );
  +        }
  +        catch( Exception e )
  +        {
  +            final String message =
  +                REZ.getString( "lifecycle-shutdown.error" );
  +            getLogger().warn( message, e );
  +        }
       }
   
       protected abstract ResourceProvider prepareResourceProvider();
  
  
  
  1.5       +2 -0      jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/kernel/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/containerkit/src/java/org/apache/excalibur/containerkit/kernel/Resources.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Resources.properties	27 Jun 2002 16:36:40 -0000	1.4
  +++ Resources.properties	2 Aug 2002 03:52:07 -0000	1.5
  @@ -1,3 +1,5 @@
   processed-component=Processed component {0}.
   components-processing=Processing component {0} in phase {1} from {2}.
   process-component=Processing component {0}, named "{1}".
  +provider-shutdown.error=Error shutting down ResourceProvider.
  +lifecycle-shutdown.error=Error shutting down LifecycleHelper.
  \ No newline at end of file
  
  
  

--
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