You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2002/11/29 14:18:01 UTC

cvs commit: avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine package.html EngineRuntimeException.java EngineException.java Engine.java DefaultEngine.java

mcconnell    2002/11/29 05:18:01

  Added:       assembly/src/java/org/apache/avalon/assembly/engine
                        package.html EngineRuntimeException.java
                        EngineException.java Engine.java DefaultEngine.java
  Log:
  Classes and interfaces that aggregate type, profile and appliance management.
  
  Revision  Changes    Path
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/package.html
  
  Index: package.html
  ===================================================================
  
  <body>
  <p>
  The <code>engine</code> package includes interfaces and classes on which a unit of containment can be manager.   An engine aggregates a type, profile and appliance manager and provides support for the creation, registration and retrival of appliance instances.
  </p>
  </body>
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/EngineRuntimeException.java
  
  Index: EngineRuntimeException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.engine;
  
  import org.apache.avalon.framework.CascadingRuntimeException;
  
  /**
   * RuntimeException to indicate that there was a engine runtime error.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/29 13:18:01 $
   */
  public class EngineRuntimeException
      extends CascadingRuntimeException
  {
  
      /**
       * Construct a new <code>EngineRuntimeException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public EngineRuntimeException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>EngineRuntimeException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public EngineRuntimeException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/EngineException.java
  
  Index: EngineException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.engine;
  
  import org.apache.avalon.framework.CascadingException;
  
  /**
   * Exception to indicate that there was a engine related error.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/29 13:18:01 $
   */
  public class EngineException
      extends CascadingException
  {
  
      /**
       * Construct a new <code>EngineException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public EngineException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>EngineException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public EngineException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/Engine.java
  
  Index: Engine.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.engine;
  
  import java.util.Map;
  
  import org.apache.avalon.framework.Version;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.meta.model.Profile;
  import org.apache.avalon.assembly.appliance.Appliance;
  import org.apache.avalon.meta.info.DependencyDescriptor;
  import org.apache.avalon.meta.info.StageDescriptor;
  
  /**
   * The appliance service provides support for the establishment of appliance instances.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/29 13:18:01 $
   */
  public interface Engine
  {
     /**
      * Register a type and associated profiles with the container.
      * @param path the path to the appliance implementation class
      * @return the appliance
      */
      void register( String path ) throws Exception;
  
     /**
      * Create a new appliance.
      * @param profile the component profile
      * @param map a map of supplimentary deployment context entries
      * @param shared TRUE if this appliance may be shared
      * @return the appliance
      */
      Appliance createAppliance( Profile profile, Map map, boolean shared ) throws Exception;
  
     /**
      * Resolve an appliance capable of supporting a service 
      * referenced.
      *
      * @param dependency a service depedency descriptor
      * @return the appliance
      */
      Appliance resolve( DependencyDescriptor dependency ) throws Exception;
  
     /**
      * Resolve an appliance capable of supporting a referenced extension.
      *
      * @param stage a lifecycle stage descriptor
      * @return the appliance
      */
      Appliance resolve( StageDescriptor stage ) throws Exception;
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/DefaultEngine.java
  
  Index: DefaultEngine.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.engine;
  
  import java.io.File;
  import java.util.Map;
  
  import org.apache.avalon.framework.Version;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.DefaultContext;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.service.DefaultServiceManager;
  import org.apache.avalon.framework.parameters.Parameters;
  import org.apache.avalon.meta.info.DependencyDescriptor;
  import org.apache.avalon.meta.info.StageDescriptor;
  import org.apache.avalon.meta.info.ReferenceDescriptor;
  import org.apache.avalon.meta.info.Type;
  import org.apache.avalon.meta.model.Profile;
  import org.apache.avalon.assembly.type.TypeManager;
  import org.apache.avalon.assembly.type.DefaultTypeManager;
  import org.apache.avalon.assembly.profile.ProfileManager;
  import org.apache.avalon.assembly.profile.DefaultProfileManager;
  import org.apache.avalon.assembly.appliance.ApplianceManager;
  import org.apache.avalon.assembly.appliance.DefaultApplianceManager;
  import org.apache.avalon.assembly.appliance.Appliance;
  import org.apache.avalon.assembly.lifestyle.LifestyleException;
  import org.apache.avalon.assembly.lifestyle.LifestyleService;
  import org.apache.avalon.assembly.lifestyle.DefaultLifestyleService;
  import org.apache.excalibur.mpool.DefaultPoolManager;
  import org.apache.excalibur.mpool.PoolManager;
  import org.apache.excalibur.event.command.CommandManager;
  import org.apache.excalibur.event.command.TPCThreadManager;
  
  /**
   * 
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/29 13:18:01 $
   */
  public class DefaultEngine extends AbstractLogEnabled implements Engine, Contextualizable, Initializable
  {
      private Context m_context;
  
      private TypeManager m_types;
      private ProfileManager m_profiles;
      private ApplianceManager m_appliances;
  
      private ClassLoader m_classloader;
  
      //==============================================================
      // Contextualizable
      //==============================================================
  
     /**
      * <p>Application of a runtime context to the lifestyle service.
      * The context value will be passed directly to lifestyle handlers 
      * established by this service.
      * @param context the runtime context
      */
      public void contextualize( Context context ) throws ContextException
      {
          try
          {
              m_classloader = (ClassLoader) context.get( "assembly:classloader" );
          }
          catch( ContextException ce )
          {
              // ignore
          }
  
          try
          {
              m_types = (TypeManager) context.get( "assembly:type-manager" );
          }
          catch( ContextException ce )
          {
              // ignore
          }
  
          try
          {
              m_profiles = (ProfileManager) context.get( "assembly:profile-manager" );
          }
          catch( ContextException ce )
          {
              // ignore
          }
  
          try
          {
              m_appliances = (ApplianceManager) context.get( "assembly:appliance-manager" );
          }
          catch( ContextException ce )
          {
              // ignore
          }
      }
  
      //==============================================================
      // Initializable
      //==============================================================
  
      public void initialize() throws Exception
      {
          if( getLogger() == null )
          {
              throw new IllegalStateException("logger");
          }
          if( m_classloader == null )
          {
              m_classloader = Thread.currentThread().getContextClassLoader();
          }
          if( m_types == null )
          {
              m_types = createTypeManager( m_classloader );
          }
          if( m_profiles == null )
          {
              m_profiles = createProfileManager( m_classloader );
          }
          if( m_appliances == null )
          {
              m_appliances = createApplianceManager( m_classloader );
          }
      }
  
      //==============================================================
      // Engine
      //==============================================================
  
     /**
      * Register a type and associated profiles with the container.
      * @param path the path to the appliance implementation class
      * @return the appliance
      */
      public void register( String path ) throws Exception
      {
          try
          {
              Type type = m_types.createType( path );
              m_types.addType( type );
              Profile[] profiles = m_profiles.loadProfiles( type );
              m_profiles.addProfiles( profiles );
          }
          catch( Throwable e )
          {
              final String error = 
                "Failed to register one or more profiles.";
              throw new EngineException( error, e );
          }
      }
  
     /**
      * Resolve an appliance capable of supporting a service 
      * referenced.
      *
      * @param dependency a service depedency descriptor
      * @return the appliance
      */
      public Appliance resolve( DependencyDescriptor dependency ) throws Exception
      {
          Appliance appliance = m_appliances.getAppliance( dependency );
          if( appliance == null )
          {
              Profile profile = m_profiles.getProfile( dependency );
              if( profile == null )
              {
                  final String error = 
                    "No profiles matching the requested dependency: " 
                    + dependency;
                  throw new EngineException( error );
              }
              else
              {
                  appliance = createAppliance( profile, null, true );
              }
          }
          return appliance;
      }
  
     /**
      * Resolve an appliance capable of supporting a referenced extension.
      *
      * @param stage a lifecycle stage descriptor
      * @return the appliance
      */
      public Appliance resolve( StageDescriptor stage ) throws Exception
      {
          Appliance appliance = m_appliances.getAppliance( stage );
          if( appliance == null )
          {
              Profile profile = m_profiles.getProfile( stage );
              if( profile == null )
              {
                  final String error = 
                    "No profiles matching the requested stage: " 
                    + stage;
                  throw new EngineException( error );
              }
              else
              {
                  appliance = createAppliance( profile );
              }
          }
          return appliance;
      }
  
     /**
      * Create a new shared appliance.
      * @param profile the component profile
      * @return the appliance
      */
      public Appliance createAppliance( Profile profile ) throws Exception
      {
          return createAppliance( profile, null );
      }
  
  
     /**
      * Create a new shared appliance.
      * @param profile the component profile
      * @param map supplimentary deployment context entries
      * @return the appliance
      */
      public Appliance createAppliance( Profile profile, Map map ) throws Exception
      {
          return createAppliance( profile, map, true );
      }
  
     /**
      * Create a new appliance.
      * @param profile the component profile
      * @param map supplimentary deployment context entries
      * @param shared TRUE if this appliance may be shared
      * @return the appliance
      */
      public Appliance createAppliance( Profile profile, Map map, boolean shared ) throws Exception
      {
          Appliance appliance = m_appliances.createAppliance( profile, true, true, map );
          if( shared )
          {
              m_appliances.addAppliance( appliance );
          }
          return appliance;
      }
  
      //==============================================================
      // utilities
      //==============================================================
  
      private ClassLoader getClassLoader( Context context )
      {
          try
          {
              return (ClassLoader) context.get( "assembly:classloader" );
          }
          catch( ContextException ce )
          {
              return Thread.currentThread().getContextClassLoader();
          }
      }
  
      private TypeManager createTypeManager( ClassLoader classloader ) throws Exception
      {
          DefaultTypeManager manager = new DefaultTypeManager();
          manager.enableLogging( getLogger().getChildLogger("types") );
          DefaultContext context = new DefaultContext();
          context.put( "assembly:classloader", classloader );
          context.makeReadOnly();
          manager.contextualize( context );
          manager.initialize();
          return manager;
      }
  
      private ProfileManager createProfileManager( ClassLoader classloader ) throws Exception
      {
          DefaultProfileManager manager = new DefaultProfileManager();
          manager.enableLogging( getLogger().getChildLogger("profiles") );
          DefaultContext context = new DefaultContext();
          context.put( "assembly:classloader", classloader );
          context.makeReadOnly();
          manager.contextualize( context );
          manager.initialize();
          return manager;
      }
  
      private ApplianceManager createApplianceManager( ClassLoader classloader ) throws Exception
      {
          DefaultApplianceManager manager = new DefaultApplianceManager();
          manager.enableLogging( getLogger() );
          DefaultContext context = new DefaultContext( getSystemContext() );
          context.put( "assembly:classloader", classloader );
          context.makeReadOnly();
          manager.contextualize( context );
          DefaultServiceManager services = new DefaultServiceManager();
          services.put( "assembly:engine", this );
          services.makeReadOnly();
          manager.service( services );
          manager.initialize();
          return manager;
      }
  
      private Context getSystemContext()
      {
          if( m_context == null )
          {
              DefaultContext context = new DefaultContext();
              final File home = new File( System.getProperty( "user.dir" ) );
              context.put( "avalon:home", home );
              context.put( "assembly:pool-manager", getPoolManager() );
              m_context = context;
          }
          return m_context;
      }
  
  
      private PoolManager getPoolManager()
      {
          try
          {
              //
              // Set up the ThreadManager that the CommandManager uses
              //
  
              TPCThreadManager threadManager = new TPCThreadManager();
              threadManager.enableLogging( getLogger().getChildLogger( "threads" ) );
              Parameters params = new Parameters();
              params.setParameter( "threads-per-processor", "2" );
              params.setParameter( "sleep-time", "1000" );
              params.setParameter( "block-timeout", "250" );
              threadManager.parameterize( params );
              threadManager.initialize();
  
              //
              // Set up the CommandManager that the PoolManager uses.
              //
  
              CommandManager commandManager = new CommandManager();
              threadManager.register( commandManager );
  
              //
              // Set up the PoolManager that the pooled lifecycle helper needs
              //
  
              DefaultPoolManager poolManager = 
                new DefaultPoolManager( commandManager.getCommandSink() );
              return poolManager;
          }
          catch( Throwable e )
          {
              final String error = 
                "Internel error during establishment of the default pool manager.";
              throw new EngineRuntimeException( error, e );
          }
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>