pgoldstein    2002/09/28 19:27:22

  Modified:    src/java/org/apache/james/transport JamesSpoolManager.java
  Log:
  Added comments, removed unused Contextualizable interface.
  
  Revision  Changes    Path
  1.17      +36 -30    
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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- JamesSpoolManager.java    14 Sep 2002 09:00:57 -0000      1.16
  +++ JamesSpoolManager.java    29 Sep 2002 02:27:22 -0000      1.17
  @@ -19,9 +19,6 @@
   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.context.Context;
  -import org.apache.avalon.framework.context.Contextualizable;
  -import org.apache.avalon.framework.context.DefaultContext;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.james.core.MailImpl;
   import org.apache.james.services.MailStore;
  @@ -45,38 +42,47 @@
    */
   public class JamesSpoolManager
       extends AbstractLogEnabled
  -    implements Contextualizable, Composable, Configurable, Initializable,
  +    implements Composable, Configurable, Initializable,
                  Runnable, Disposable, Component {
   
       /**
        * Whether 'deep debugging' is turned on.
  -     *
  -     * TODO: Shouldn't this be false by default?
        */
  -    private final static boolean DEEP_DEBUG = true;
  +    private final static boolean DEEP_DEBUG = false;
   
  +    /**
  +     * System component manager
  +     */
       private DefaultComponentManager compMgr;
  -    //using implementation as we need put method.
  +
  +    /**
  +     * The configuration object used by this spool manager.
  +     */
       private Configuration conf;
  -    private Context context;
  +
       private SpoolRepository spool;
  -    private MailetContext mailetcontext;
  +
  +    private MailetContext mailetContext;
  +
  +    /**
  +     * The map of processor names to processors
  +     */
       private HashMap processors;
  -    private int threads;
  +
  +    /**
  +     * The number of threads used to move mail through the spool.
  +     */
  +    private int numThreads;
  +
  +    /**
  +     * The ThreadPool containing the spool threads.
  +     */
       private ThreadPool workerPool;
  -    private ThreadManager threadManager;
   
       /**
  -     * Pass the Context to the component.
  -     * This method is called after the setLogger()
  -     * method and before any other method.
  -     *
  -     * @param context the context
  -     * @throws ContextException if context is invalid
  +     * The ThreadManager from which the thread pool is obtained.
        */
  -    public void contextualize(Context context) {
  -        this.context = new DefaultContext( context );
  -    }
  +    private ThreadManager threadManager;
   
       /**
        * Pass the <code>ComponentManager</code> to the <code>composer</code>.
  @@ -101,7 +107,7 @@
        */
       public void configure(Configuration conf) throws ConfigurationException {
           this.conf = conf;
  -        threads = conf.getChild("threads").getValueAsInteger(1);
  +        numThreads = conf.getChild("threads").getValueAsInteger(1);
       }
   
       /**
  @@ -130,7 +136,7 @@
               getLogger().debug("Got spool");
           }
   
  -        mailetcontext
  +        mailetContext
               = (MailetContext) compMgr.lookup("org.apache.mailet.MailetContext");
           MailetLoader mailetLoader = new MailetLoader();
           MatchLoader matchLoader = new MatchLoader();
  @@ -169,9 +175,9 @@
                   //  mailet silently to the top
                   if (processorName.equals("root")) {
                       Matcher matcher = matchLoader.getMatcher("All",
  -                                                             mailetcontext);
  +                                                             mailetContext);
                       Mailet mailet = mailetLoader.getMailet("PostmasterAlias",
  -                                                           mailetcontext, null);
  +                                                           mailetContext, null);
                       processor.add(matcher, mailet);
                   }
   
  @@ -189,7 +195,7 @@
                       Matcher matcher = null;
                       try {
                           matcher = matchLoader.getMatcher(matcherName,
  -                                                         mailetcontext);
  +                                                         mailetContext);
                           //The matcher itself should log that it's been inited.
                           if (getLogger().isInfoEnabled()) {
                               StringBuffer infoBuffer =
  @@ -218,7 +224,7 @@
                       }
                       try {
                           mailet = mailetLoader.getMailet(mailetClassName,
  -                                                        mailetcontext, c);
  +                                                        mailetContext, c);
                           if (getLogger().isInfoEnabled()) {
                               StringBuffer infoBuffer =
                                   new StringBuffer(64)
  @@ -280,11 +286,11 @@
               StringBuffer infoBuffer =
                   new StringBuffer(64)
                       .append("Spooler Manager uses ")
  -                    .append(threads)
  +                    .append(numThreads)
                       .append(" Thread(s)");
               getLogger().info(infoBuffer.toString());
           }
  -        for ( int i = 0 ; i < threads ; i++ )
  +        for ( int i = 0 ; i < numThreads ; i++ )
               workerPool.execute(this);
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to