james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-james/src/java/org/apache/james/transport JamesSpoolManager.java JamesSpoolManager.xinfo
Date Thu, 20 Sep 2001 01:11:06 GMT
donaldp     01/09/19 18:11:06

  Modified:    lib      cornerstone-20010919.bar
               src/conf james-assembly.xml james-config.xml
               src/java/org/apache/james/transport JamesSpoolManager.java
                        JamesSpoolManager.xinfo
  Log:
  Updated to use Avalons new ThreadManager service rather than relying on container to manage
threads.
  
  Revision  Changes    Path
  1.2       +157 -131  jakarta-james/lib/cornerstone-20010919.bar
  
  	<<Binary file>>
  
  
  1.3       +17 -8     jakarta-james/src/conf/james-assembly.xml
  
  Index: james-assembly.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/conf/james-assembly.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- james-assembly.xml	2001/09/11 04:29:30	1.2
  +++ james-assembly.xml	2001/09/20 01:11:06	1.3
  @@ -21,15 +21,15 @@
   
     <!-- The James Spool Manager block  -->
     <block class="org.apache.james.transport.JamesSpoolManager" 
  -	name="spoolmanager" >
  +         name="spoolmanager" >
       <provide name="James" role="org.apache.mailet.MailetContext"/>
       <provide name="mailstore" role="org.apache.james.services.MailStore"/>
  +    <provide name="thread-manager" 
  +             role="org.apache.avalon.cornerstone.services.threads.ThreadManager" />
     </block>
   
  +  <block class="org.apache.james.dnsserver.DNSServer" name="dnsserver"/>
   
  -  <block class="org.apache.james.dnsserver.DNSServer" name="dnsserver">
  -  </block>
  -
     <block class="org.apache.james.remotemanager.RemoteManager" name="remotemanager" >
       <provide name="mailstore" role="org.apache.james.services.MailStore"/>
       <provide name="users-store" role="org.apache.james.services.UsersStore"/>
  @@ -129,20 +129,29 @@
     <!-- The Connection Manager block -->
     <block class="org.apache.avalon.cornerstone.blocks.connection.DefaultConnectionManager"

              name="connections">
  +    <provide name="thread-manager" 
  +             role="org.apache.avalon.cornerstone.services.threads.ThreadManager" />
     </block>
   
     <!-- The Socket Manager block -->
     <block class="org.apache.avalon.cornerstone.blocks.sockets.DefaultSocketManager"
  -         name="sockets">
  -  </block>
  +         name="sockets"/>
   
     <!-- The Time Manager block -->
     <block class="org.apache.avalon.cornerstone.blocks.scheduler.DefaultTimeScheduler"

  -         name="scheduler"/>
  -         
  +         name="scheduler">
  +    <provide name="thread-manager" 
  +             role="org.apache.avalon.cornerstone.services.threads.ThreadManager" />
  +  </block>
  +        
     <!-- The DataSourceSelector block -->
     <block class="org.apache.avalon.cornerstone.blocks.datasource.DefaultDataSourceSelector"

            name="database-connections"/>
  +
  +  <!-- The ThreadManager block -->
  +  <block class="org.apache.avalon.cornerstone.blocks.threads.DefaultThreadManager" 
  +         name="thread-manager" />
  +
   
   </assembly>
   
  
  
  
  1.12      +19 -2     jakarta-james/src/conf/james-config.xml
  
  Index: james-config.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/conf/james-config.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- james-config.xml	2001/09/13 20:30:08	1.11
  +++ james-config.xml	2001/09/20 01:11:06	1.12
  @@ -13,8 +13,8 @@
       CONFIRM? comment in the left
       margin.
   
  -    This is $Revision: 1.11 $
  -    Committed on $Date: 2001/09/13 20:30:08 $ by: $Author: charlesb $
  +    This is $Revision: 1.12 $
  +    Committed on $Date: 2001/09/20 01:11:06 $ by: $Author: donaldp $
   -->
   <config>
   
  @@ -661,5 +661,22 @@
                    class="org.apache.avalon.cornerstone.blocks.sockets.DefaultSocketFactory"
/>
         </client-sockets>
     </sockets>
  +
  +  <thread-manager>
  +      <thread-group>
  +        <name>default</name>
  +
  +        <!-- normal priority == 5, max-priority = 10 -->
  +        <priority>5</priority> 
  +
  +        <!-- are threads deamon threads ? -->
  +        <is-daemon>false</is-daemon>
  +
  +        <max-threads>40</max-threads>
  +        <!-- these are ignored at the moment but will be fixed in later revisions -->
  +        <min-threads>20</min-threads>
  +        <min-spare-threads>20</min-spare-threads>
  +      </thread-group>
  +  </thread-manager>
   
   </config>
  
  
  
  1.5       +19 -17    jakarta-james/src/java/org/apache/james/transport/JamesSpoolManager.java
  
  Index: JamesSpoolManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/JamesSpoolManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JamesSpoolManager.java	2001/09/11 04:34:20	1.4
  +++ JamesSpoolManager.java	2001/09/20 01:11:06	1.5
  @@ -11,8 +11,11 @@
   import java.net.*;
   import java.util.*;
   import javax.mail.MessagingException;
  -import org.apache.avalon.framework.activity.Initializable;
  +import org.apache.avalon.cornerstone.services.threads.ThreadManager;
  +import org.apache.avalon.excalibur.thread.ThreadPool;
   import org.apache.avalon.framework.activity.Disposable;
  +import org.apache.avalon.framework.activity.Initializable;
  +import org.apache.avalon.framework.component.ComponentException;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.component.DefaultComponentManager;
  @@ -23,20 +26,18 @@
   import org.apache.avalon.framework.context.Contextualizable;
   import org.apache.avalon.framework.context.DefaultContext;
   import org.apache.avalon.framework.logger.AbstractLoggable;
  -import org.apache.avalon.excalibur.thread.ThreadPool;
  +import org.apache.avalon.phoenix.Block;
   import org.apache.james.*;
   import org.apache.james.core.*;
   import org.apache.james.services.*;
   import org.apache.mailet.*;
  -import org.apache.avalon.phoenix.Block;
  -import org.apache.avalon.phoenix.BlockContext;
   
   /**
    * @author Serge Knystautas <sergek@lokitech.com>
    * @author Federico Barbieri <scoobie@systemy.it>
    *
  - * This is $Revision: 1.4 $
  - * Committed on $Date: 2001/09/11 04:34:20 $ by: $Author: serge $
  + * This is $Revision: 1.5 $
  + * Committed on $Date: 2001/09/20 01:11:06 $ by: $Author: donaldp $
    */
   public class JamesSpoolManager
       extends AbstractLoggable
  @@ -52,8 +53,8 @@
       private MailetContext mailetcontext;
       private HashMap processors;
       private int threads;
  -    protected BlockContext           blockContext;
       private ThreadPool workerPool;
  +    private ThreadManager threadManager;
   
       public void configure(Configuration conf) throws ConfigurationException {
           this.conf = conf;
  @@ -62,24 +63,25 @@
   
       public void contextualize(Context context) {
           this.context = new DefaultContext( context );
  -        this.blockContext = (BlockContext)context;
       }
   
  -    public void compose(ComponentManager comp) {
  +    public void compose(ComponentManager comp) 
  +        throws ComponentException {
  +        threadManager = (ThreadManager)comp.lookup( ThreadManager.ROLE );
           compMgr = new DefaultComponentManager(comp);
       }
   
       public void initialize() throws Exception {
   
           getLogger().info("JamesSpoolManager init...");
  -        workerPool = blockContext.getThreadPool( "default" );
  +        workerPool = threadManager.getThreadPool( "default" );
           MailStore mailstore
  -          = (MailStore) compMgr.lookup("org.apache.james.services.MailStore");
  +            = (MailStore) compMgr.lookup("org.apache.james.services.MailStore");
           spool = mailstore.getInboundSpool();
           if (DEEP_DEBUG) getLogger().debug("Got spool");
   
           mailetcontext
  -          = (MailetContext) compMgr.lookup("org.apache.mailet.MailetContext");
  +            = (MailetContext) compMgr.lookup("org.apache.mailet.MailetContext");
           MailetLoader mailetLoader = new MailetLoader();
           MatchLoader matchLoader = new MatchLoader();
           try {
  @@ -116,7 +118,7 @@
                       Matcher matcher = matchLoader.getMatcher("All",
                                                                mailetcontext);
                       Mailet mailet = mailetLoader.getMailet("PostmasterAlias",
  -                                                          mailetcontext, null);
  +                                                           mailetcontext, null);
                       processor.add(matcher, mailet);
                   }
   
  @@ -138,18 +140,18 @@
                       } catch (MessagingException ex) {
                           // **** Do better job printing out exception
                           getLogger().error( "Unable to init matcher "
  -                                   + matcherName + ": " + ex.toString(), ex );
  +                                           + matcherName + ": " + ex.toString(), ex );
                           throw ex;
                       }
                       try {
                           mailet = mailetLoader.getMailet(mailetClassName,
  -                                                         mailetcontext, c);
  +                                                        mailetcontext, c);
                           getLogger().info("Mailet " + mailetClassName
                                            + " instantiated");
                       } catch (MessagingException ex) {
                           // **** Do better job printing out exception
                           getLogger().error("Unable to init mailet "
  -                                   + mailetClassName + ": " + ex.getMessage());
  +                                          + mailetClassName + ": " + ex.getMessage());
                           throw ex;
                       }
                       //Add this pair to the proces
  @@ -163,7 +165,7 @@
                   //   it will always be ghosted
                   Matcher matcher = matchLoader.getMatcher("All", mailetcontext);
                   Mailet mailet
  -                         = mailetLoader.getMailet("Null", mailetcontext, null);
  +                    = mailetLoader.getMailet("Null", mailetcontext, null);
                   processor.add(matcher, mailet);
   
                   getLogger().info("processor " + processorName
  
  
  
  1.2       +4 -0      jakarta-james/src/java/org/apache/james/transport/JamesSpoolManager.xinfo
  
  Index: JamesSpoolManager.xinfo
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/JamesSpoolManager.xinfo,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JamesSpoolManager.xinfo	2001/05/11 10:36:19	1.1
  +++ JamesSpoolManager.xinfo	2001/09/20 01:11:06	1.2
  @@ -14,5 +14,9 @@
         <role>org.apache.james.services.MailStore</role>
         <service name="org.apache.james.services.MailStore" version="1.0"/>
       </dependency>
  +    <dependency>
  +      <role>org.apache.avalon.cornerstone.services.threads.ThreadManager</role>
  +      <service name="org.apache.avalon.cornerstone.services.threads.ThreadManager" version="1.0"/>
  +    </dependency>
     </dependencies>  
   </blockinfo>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: james-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: james-dev-help@jakarta.apache.org


Mime
View raw message