You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ba...@apache.org on 2006/05/13 02:03:02 UTC

svn commit: r405951 - in /james/server/trunk/src/java/org/apache/james/transport: JamesSpoolManager.java LinearProcessor.java

Author: bago
Date: Fri May 12 17:03:02 2006
New Revision: 405951

URL: http://svn.apache.org/viewcvs?rev=405951&view=rev
Log:
Refactored the spool.store/spool.unlock code for the SPoolManager (part of JAMES-491)
Now the main mail is stored by the spoolmanager while LinearProcessor only manage storing of "splitted" mails.



Modified:
    james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.java
    james/server/trunk/src/java/org/apache/james/transport/LinearProcessor.java

Modified: james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.java?rev=405951&r1=405950&r2=405951&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.java Fri May 12 17:03:02 2006
@@ -208,7 +208,10 @@
                     // spool.remove() has a side-effect!  It unlocks the
                     // message so that other threads can work on it!  If
                     // we don't remove it, we must unlock it!
+                    spool.store(mail);
                     spool.unlock(key);
+                    // Do not notify: we simply updated the current mail
+                    // and we are able to reprocess it now.
                 }
                 mail = null;
             } catch (InterruptedException ie) {

Modified: james/server/trunk/src/java/org/apache/james/transport/LinearProcessor.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/LinearProcessor.java?rev=405951&r1=405950&r2=405951&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/LinearProcessor.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/LinearProcessor.java Fri May 12 17:03:02 2006
@@ -300,6 +300,11 @@
 
         //This is the original state of the message
         String originalState = mail.getState();
+        
+        
+        // The original mail: we should not care to save this mail.
+        // This should be saved in the spoolmanager.
+        Mail originalMail = mail;
 
         //We'll use these as temporary variables in the loop
         mail = null;  // the message we're currently processing
@@ -402,7 +407,8 @@
                 // and store it in the next spot
                 Mail notMail = new MailImpl(mail,newName(mail));
                 notMail.setRecipients(notRecipients);
-                notMail.setState(mail.getState());
+                // set the state to the current processor
+                notMail.setState(originalState);
                 unprocessed[i + 1].add(notMail);
                 //We have to set the reduce possible recipients on the old message
                 mail.setRecipients(recipients);
@@ -450,7 +456,11 @@
                 // This was just set to another state requiring further processing... 
                 // Store this back in the spool and it will get picked up and 
                 // run in that processor
-                spool.store(mail);
+                // We store only mails created by the matcher "splitting"
+                // The original mail will be "stored" by the caller.
+                if (originalMail != mail) {
+                    spool.store(mail);
+                }
                 mail = null;
                 continue;
             } else {



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