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 2003/06/16 16:31:39 UTC

cvs commit: avalon-cornerstone/threads/tutorial/src/java/org/apache/avalon/cornerstone/threads/tutorial ThreadConsumer.java

mcconnell    2003/06/16 07:31:39

  Modified:    threads  README.TXT maven.xml project.xml
               threads/api project.xml
               threads/impl project.xml
               threads/impl/src/java/org/apache/avalon/cornerstone/blocks/threads
                        DefaultThreadManager.java
               threads/tutorial project.xml
               threads/tutorial/conf block.xml
               threads/tutorial/src/java/org/apache/avalon/cornerstone/threads/tutorial
                        ThreadConsumer.java
  Added:       threads/impl/src/java/org/apache/avalon/cornerstone/blocks/threads
                        AbstractThreadManager.java
                        ResourceLimitingThreadManager-schema.xml
                        ResourceLimitingThreadManager.java
                        ResourceLimitingThreadManager.xinfo
  Log:
  Updating of the threads package including sync. with recent changes to the main strc directory.
  
  Revision  Changes    Path
  1.2       +4 -8      avalon-cornerstone/threads/README.TXT
  
  Index: README.TXT
  ===================================================================
  RCS file: /home/cvs/avalon-cornerstone/threads/README.TXT,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- README.TXT	4 May 2003 13:40:17 -0000	1.1
  +++ README.TXT	16 Jun 2003 14:31:38 -0000	1.2
  @@ -2,14 +2,10 @@
   Cornerstone Threads.
   --------------------
   
  -This directory contains two subprojects.  One subject contains the api 
  -defintion and the other contains the default cornerstone implementation.
  -A convinience target is defined that wil automate the build of the two 
  -subprojects:
  +This directory contains three subprojects.  These include the api classes,
  +the implementation classes, and a tutorial package.  The default target 
  +at this level automates the build of the three subprojects.
   
     $ cd avalon-cornerstone\threads
  -  $ maven build
  +  $ maven
   
  -PLease note that the build assumes that you have placed the 
  -excalibur-threads-1.1.1.jar into you local Maven repository under the 
  -the directory %MAVEN_HOME%\repository\excalibur\jars.
  
  
  
  1.6       +0 -2      avalon-cornerstone/threads/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/avalon-cornerstone/threads/maven.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- maven.xml	5 May 2003 13:03:30 -0000	1.5
  +++ maven.xml	16 Jun 2003 14:31:38 -0000	1.6
  @@ -45,6 +45,4 @@
       <attainGoal name="package-install"/>
     </goal>
   
  -
  -
   </project>
  
  
  
  1.4       +2 -2      avalon-cornerstone/threads/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon-cornerstone/threads/project.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- project.xml	6 May 2003 22:52:01 -0000	1.3
  +++ project.xml	16 Jun 2003 14:31:38 -0000	1.4
  @@ -4,7 +4,7 @@
   
     <extend>${basedir}/../project.xml</extend>
   
  -  <groupId>cornerstone</groupId>
  +  <groupId>cornerstone-threads</groupId>
     <id>cornerstone-threads</id>
     <name>Cornerstone Threads</name>
     <package>org.apache.avalon.cornerstone.threads</package>
  @@ -44,7 +44,7 @@
       </unitTest>
   
       <integrationUnitTestPatterns></integrationUnitTestPatterns>
  -    
  +
       <resources>
         <resource>
           <directory>${basedir}/src/java</directory>
  
  
  
  1.2       +2 -3      avalon-cornerstone/threads/api/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon-cornerstone/threads/api/project.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- project.xml	4 May 2003 13:34:42 -0000	1.1
  +++ project.xml	16 Jun 2003 14:31:38 -0000	1.2
  @@ -4,7 +4,7 @@
   
     <extend>${basedir}/../project.xml</extend>
   
  -  <groupId>cornerstone</groupId>
  +  <groupId>cornerstone-threads</groupId>
     <id>cornerstone-threads-api</id>
     <name>Cornerstone Threads API</name>
     <currentVersion>1.0</currentVersion>
  @@ -17,8 +17,7 @@
       <!-- excalibur dependencies -->
   
       <dependency>
  -      <groupId>excalibur</groupId>
  -      <artifactId>excalibur-thread</artifactId>
  +      <id>excalibur-thread</id>
         <version>1.1.1</version>
       </dependency>
   
  
  
  
  1.2       +10 -9     avalon-cornerstone/threads/impl/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon-cornerstone/threads/impl/project.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- project.xml	4 May 2003 13:34:42 -0000	1.1
  +++ project.xml	16 Jun 2003 14:31:38 -0000	1.2
  @@ -4,7 +4,7 @@
   
     <extend>${basedir}/../project.xml</extend>
   
  -  <groupId>cornerstone</groupId>
  +  <groupId>cornerstone-threads</groupId>
     <id>cornerstone-threads-impl</id>
     <name>Cornerstone Thread Manager Implementation</name>
     <currentVersion>1.0</currentVersion>
  @@ -18,7 +18,7 @@
       <!-- cornerstone api dependencies -->
   
       <dependency>
  -      <groupId>cornerstone</groupId>
  +      <groupId>cornerstone-threads</groupId>
         <artifactId>cornerstone-threads-api</artifactId>
         <version>1.0</version>
       </dependency>
  @@ -26,22 +26,23 @@
       <!-- avalon dependencies -->
   
       <dependency>
  -      <groupId>avalon</groupId>
  -      <artifactId>avalon-framework</artifactId>
  +      <id>avalon-framework</id>
         <version>4.1.4</version>
       </dependency>
   
       <!-- excalibur dependencies -->
   
       <dependency>
  -      <groupId>excalibur</groupId>
  -      <artifactId>excalibur-thread</artifactId>
  +      <id>excalibur-thread</id>
         <version>1.1.1</version>
       </dependency>
       <dependency>
  -      <groupId>excalibur</groupId>
  -      <artifactId>excalibur-event</artifactId>
  -      <version>2.0</version>
  +      <id>excalibur-pool</id>
  +      <version>1.2</version>
  +    </dependency>
  +    <dependency>
  +      <id>excalibur-event</id>
  +      <version>1.0.3</version>
       </dependency>
   
       <!-- pre JDK 1.4 dependencies -->
  
  
  
  1.4       +8 -69     avalon-cornerstone/threads/impl/src/java/org/apache/avalon/cornerstone/blocks/threads/DefaultThreadManager.java
  
  Index: DefaultThreadManager.java
  ===================================================================
  RCS file: /home/cvs/avalon-cornerstone/threads/impl/src/java/org/apache/avalon/cornerstone/blocks/threads/DefaultThreadManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultThreadManager.java	6 May 2003 22:39:33 -0000	1.3
  +++ DefaultThreadManager.java	16 Jun 2003 14:31:38 -0000	1.4
  @@ -50,56 +50,27 @@
   
   package org.apache.avalon.cornerstone.blocks.threads;
   
  -import java.util.HashMap;
  -import org.apache.avalon.cornerstone.services.threads.ThreadManager;
  -import org.apache.avalon.excalibur.thread.ThreadPool;
  +import java.util.Map;
   import org.apache.avalon.excalibur.thread.impl.DefaultThreadPool;
  -import org.apache.avalon.framework.configuration.Configurable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  -import org.apache.avalon.framework.logger.AbstractLogEnabled;
   
   /**
    * Default implementation of ThreadManager.
    *
  + * @phoenix:block
  + * @phoenix:service name="org.apache.avalon.cornerstone.services.threads.ThreadManager"
  + *
    * @author <a href="mailto:peter at apache.org">Peter Donald</a>
  - * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
  - * @version $Revision$ $Date$
    */
   public class DefaultThreadManager
  -    extends AbstractLogEnabled
  -    implements ThreadManager, Configurable
  +    extends AbstractThreadManager
   {
  -    ///Map of thread pools for application
  -    private HashMap m_threadPools = new HashMap();
  -
  -    /**
  -     * Setup thread pools based on configuration data.
  -     *
  -     * @param configuration the configuration data
  -     * @exception ConfigurationException if an error occurs
  -     */
  -    public void configure( final Configuration configuration )
  -        throws ConfigurationException
  -    {
  -        final Configuration[] groups = configuration.getChildren( "thread-group" );
  -        for( int i = 0; i < groups.length; i++ )
  -        {
  -            configureThreadPool( groups[ i ] );
  -        }
  -    }
  -
  -    private void configureThreadPool( final Configuration configuration )
  +    protected void configureThreadPool( final Map threadPools,
  +                                        final Configuration configuration )
           throws ConfigurationException
       {
           final String name = configuration.getChild( "name" ).getValue();
  -
  -        if( getLogger().isDebugEnabled() )
  -        {
  -            final String message = "Configuring thread pool: " + name;
  -            getLogger().debug( message );
  -        }
  -
           // NEVER USED!!
           //final int priority = configuration.getChild( "priority" ).getValueAsInteger( 5 );
           final boolean isDaemon = configuration.getChild( "is-daemon" ).getValueAsBoolean( false );
  @@ -117,44 +88,12 @@
                   new DefaultThreadPool( name, minThreads, maxThreads );
               threadPool.setDaemon( isDaemon );
               threadPool.enableLogging( getLogger() );
  -            m_threadPools.put( name, threadPool );
  +            threadPools.put( name, threadPool );
           }
           catch( final Exception e )
           {
               final String message = "Error creating ThreadPool named " + name;
               throw new ConfigurationException( message, e );
           }
  -    }
  -
  -    /**
  -     * Retrieve a thread pool by name.
  -     *
  -     * @param name the name of thread pool
  -     * @return the threadpool
  -     * @exception IllegalArgumentException if the name of thread pool is
  -     *            invalid or named pool does not exist
  -     */
  -    public ThreadPool getThreadPool( final String name )
  -        throws IllegalArgumentException
  -    {
  -        final ThreadPool threadPool = (ThreadPool)m_threadPools.get( name );
  -
  -        if( null == threadPool )
  -        {
  -            final String message = "Unable to locate ThreadPool named " + name;
  -            throw new IllegalArgumentException( message );
  -        }
  -
  -        return threadPool;
  -    }
  -
  -    /**
  -     * Retrieve the default thread pool.
  -     *
  -     * @return the thread pool
  -     */
  -    public ThreadPool getDefaultThreadPool()
  -    {
  -        return getThreadPool( "default" );
       }
   }
  
  
  
  1.1                  avalon-cornerstone/threads/impl/src/java/org/apache/avalon/cornerstone/blocks/threads/AbstractThreadManager.java
  
  Index: AbstractThreadManager.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 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 Cornerstone", "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.cornerstone.blocks.threads;
  
  import java.util.HashMap;
  import java.util.Map;
  import org.apache.avalon.cornerstone.services.threads.ThreadManager;
  import org.apache.avalon.excalibur.thread.ThreadPool;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  
  /**
   * Abstract implementation of ThreadManager.
   *
   * @author <a href="mailto:peter at apache.org">Peter Donald</a>
   * @author <a href="mailto:leif at apache.org">Leif Mortenson</a>
   */
  public abstract class AbstractThreadManager
      extends AbstractLogEnabled
      implements ThreadManager, Configurable
  {
      ///Map of thread pools for application
      private HashMap m_threadPools = new HashMap();
  
      /**
       * Setup thread pools based on configuration data.
       *
       * @param configuration the configuration data
       * @exception ConfigurationException if an error occurs
       * @phoenix:configuration-schema type="http://relaxng.org/ns/structure/1.0"
       */
      public void configure( final Configuration configuration )
          throws ConfigurationException
      {
          final Configuration[] groups = configuration.getChildren( "thread-group" );
          for( int i = 0; i < groups.length; i++ )
          {
              configureThreadPool( m_threadPools, groups[ i ] );
          }
      }
  
      protected abstract void configureThreadPool( final Map threadPools,
                                                   final Configuration configuration )
          throws ConfigurationException;
  
      /**
       * Retrieve a thread pool by name.
       *
       * @param name the name of thread pool
       * @return the threadpool
       * @exception IllegalArgumentException if the name of thread pool is
       *            invalid or named pool does not exist
       */
      public ThreadPool getThreadPool( final String name )
          throws IllegalArgumentException
      {
          final ThreadPool threadPool = (ThreadPool)m_threadPools.get( name );
  
          if( null == threadPool )
          {
              final String message = "Unable to locate ThreadPool named " + name;
              throw new IllegalArgumentException( message );
          }
  
          return threadPool;
      }
  
      /**
       * Retrieve the default thread pool.
       *
       * @return the thread pool
       */
      public ThreadPool getDefaultThreadPool()
      {
          return getThreadPool( "default" );
      }
  }
  
  
  
  1.1                  avalon-cornerstone/threads/impl/src/java/org/apache/avalon/cornerstone/blocks/threads/ResourceLimitingThreadManager-schema.xml
  
  Index: ResourceLimitingThreadManager-schema.xml
  ===================================================================
  <?xml version="1.0"?>
  <element
      name="root"
      xmlns="http://relaxng.org/ns/structure/1.0"
      datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"
      xmlns:a="http://jakarta.apache.org/phoenix/schema-annotations/1.0"
  >
      <oneOrMore>
          <element name="thread-group">
              <interleave>
                  <element name="name"><text/></element>
                  <element name="is-daemon"><data type="boolean"/></element>
                  <element name="max-threads"><data type="integer"/></element>
                  <element name="max-strict"><data type="boolean"/></element>
                  <element name="blocking"><data type="boolean"/></element>
                  <element name="block-timeout"><data type="long"/></element>
                  <element name="trim-interval"><data type="long"/></element>
              </interleave>
          </element>
      </oneOrMore>
  </element>
  
  
  
  1.1                  avalon-cornerstone/threads/impl/src/java/org/apache/avalon/cornerstone/blocks/threads/ResourceLimitingThreadManager.java
  
  Index: ResourceLimitingThreadManager.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 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 Cornerstone", "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.cornerstone.blocks.threads;
  
  import java.util.Map;
  import org.apache.avalon.excalibur.thread.impl.ResourceLimitingThreadPool;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  
  /**
   * Default implementation of ThreadManager.
   *
   * @phoenix:block
   * @phoenix:service name="org.apache.avalon.cornerstone.services.threads.ThreadManager"
   *
   * @author <a href="mailto:leif at apache.org">Leif Mortenson</a>
   */
  public class ResourceLimitingThreadManager
      extends AbstractThreadManager
  {
      protected void configureThreadPool( final Map threadPools,
                                          final Configuration configuration )
          throws ConfigurationException
      {
          final String name = configuration.getChild( "name" ).getValue();
          final boolean isDaemon = configuration.getChild( "is-daemon" ).getValueAsBoolean( false );
          
          final int max = configuration.getChild( "max-threads" ).getValueAsInteger( 10 );
          final boolean maxStrict = configuration.getChild( "max-strict" ).getValueAsBoolean( true );
          final boolean blocking = configuration.getChild( "blocking" ).getValueAsBoolean( true );
          final long blockTimeout = configuration.getChild( "block-timeout" ).getValueAsLong( 0 );
          final long trimInterval = configuration.getChild( "trim-interval" ).getValueAsLong( 10000 );
  
          try
          {
              final ResourceLimitingThreadPool threadPool = new ResourceLimitingThreadPool(
                  name, max, maxStrict, blocking, blockTimeout, trimInterval );
              threadPool.setDaemon( isDaemon );
              threadPool.enableLogging( getLogger() );
              threadPools.put( name, threadPool );
          }
          catch( final Exception e )
          {
              final String message = "Error creating ThreadPool named " + name;
              throw new ConfigurationException( message, e );
          }
      }
  }
  
  
  
  1.1                  avalon-cornerstone/threads/impl/src/java/org/apache/avalon/cornerstone/blocks/threads/ResourceLimitingThreadManager.xinfo
  
  Index: ResourceLimitingThreadManager.xinfo
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE blockinfo PUBLIC "-//PHOENIX/Block Info DTD Version 1.0//EN"
                    "http://jakarta.apache.org/avalon/dtds/phoenix/blockinfo_1_0.dtd">
  
  <blockinfo>
  
    <block>
      <version>1.0</version>
      <schema-type>http://relaxng.org/ns/structure/1.0</schema-type>
    </block>
  
    <services>
      <service name="org.apache.avalon.cornerstone.services.threads.ThreadManager"/>
    </services>
  
  </blockinfo>
  
  
  
  1.2       +11 -9     avalon-cornerstone/threads/tutorial/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon-cornerstone/threads/tutorial/project.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- project.xml	4 May 2003 17:19:32 -0000	1.1
  +++ project.xml	16 Jun 2003 14:31:38 -0000	1.2
  @@ -4,7 +4,7 @@
   
     <extend>${basedir}/../project.xml</extend>
   
  -  <groupId>cornerstone</groupId>
  +  <groupId>cornerstone-threads</groupId>
     <id>cornerstone-threads-tutorial</id>
     <name>Cornerstone Threads Tutorial</name>
     <currentVersion>1.0</currentVersion>
  @@ -18,7 +18,7 @@
       <!-- cornerstone api dependencies -->
   
       <dependency>
  -      <groupId>cornerstone</groupId>
  +      <groupId>cornerstone-threads</groupId>
         <artifactId>cornerstone-threads-api</artifactId>
         <version>1.0</version>
       </dependency>
  @@ -26,23 +26,25 @@
       <!-- avalon dependencies -->
   
       <dependency>
  -      <groupId>avalon</groupId>
  -      <artifactId>avalon-framework</artifactId>
  +      <id>avalon-framework</id>
         <version>4.1.4</version>
       </dependency>
   
       <!-- excalibur dependencies -->
   
       <dependency>
  -      <groupId>excalibur</groupId>
  -      <artifactId>excalibur-thread</artifactId>
  +      <id>excalibur-thread</id>
         <version>1.1.1</version>
       </dependency>
   
       <dependency>
  -      <groupId>excalibur</groupId>
  -      <artifactId>excalibur-event</artifactId>
  -      <version>2.0</version>
  +      <id>excalibur-pool</id>
  +      <version>1.2</version>
  +    </dependency>
  +
  +    <dependency>
  +      <id>excalibur-event</id>
  +      <version>1.0.3</version>
       </dependency>
   
       <!-- pre JDK 1.4 dependencies -->
  
  
  
  1.2       +0 -2      avalon-cornerstone/threads/tutorial/conf/block.xml
  
  Index: block.xml
  ===================================================================
  RCS file: /home/cvs/avalon-cornerstone/threads/tutorial/conf/block.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- block.xml	6 May 2003 23:11:16 -0000	1.1
  +++ block.xml	16 Jun 2003 14:31:38 -0000	1.2
  @@ -11,8 +11,6 @@
   
      <implementation>
   
  -     <categories priority="INFO"/>
  -
        <engine>
          <classpath>
            <repository>
  
  
  
  1.3       +18 -4     avalon-cornerstone/threads/tutorial/src/java/org/apache/avalon/cornerstone/threads/tutorial/ThreadConsumer.java
  
  Index: ThreadConsumer.java
  ===================================================================
  RCS file: /home/cvs/avalon-cornerstone/threads/tutorial/src/java/org/apache/avalon/cornerstone/threads/tutorial/ThreadConsumer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ThreadConsumer.java	5 May 2003 20:50:28 -0000	1.2
  +++ ThreadConsumer.java	16 Jun 2003 14:31:39 -0000	1.3
  @@ -31,6 +31,11 @@
       private ThreadManager m_threads;
   
      /**
  +    * A thread pool aquired from the thread manager.
  +    */
  +    private ThreadPool m_pool;
  +
  +   /**
       * A thread control return from the launching of a new thread.
       */
       private ThreadControl m_control;
  @@ -49,9 +54,9 @@
           m_manager = manager;
           getLogger().info( "aquiring cornerstone threads service" );
           m_threads = (ThreadManager) m_manager.lookup( "threads" );
  +        getLogger().info( "thread manager aquired: " + m_threads );
       }
   
  -
      /**
       * Initialization of the component by the container during which we 
       * establish a child thread by passing a runnable object to the thread pool.
  @@ -65,7 +70,7 @@
           // get the default thread pool
           //
   
  -        ThreadPool pool = m_threads.getDefaultThreadPool();
  +        m_pool = m_threads.getDefaultThreadPool();
   
           //
           // create a runnable object to run
  @@ -78,7 +83,7 @@
           // start a thread and get the thread control reference
           //
   
  -        m_control = pool.execute( counter );
  +        m_control = m_pool.execute( counter );
       }
   
      /**
  @@ -123,9 +128,18 @@
   
           if( m_control.getThrowable() != null )
           {
  -            getLogger().info( 
  +            getLogger().warn( 
                 "thread terminated with exception condition", 
                  m_control.getThrowable() );
  +        }
  +
  +        if( m_pool != null )
  +        {
  +            if( m_pool instanceof Disposable )
  +            {
  +                ((Disposable)m_pool).dispose();
  +            }
  +            m_pool = null;
           }
   
           m_manager.release( m_threads );
  
  
  

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