Author: bago
Date: Thu Aug  3 15:56:47 2006
New Revision: 428557

URL: http://svn.apache.org/viewvc?rev=428557&view=rev
Log:
Backport JAMES-584 fix:
r428073: Added a few missing call to MailImpl.dispose() method (Investigating 
JAMES-584)
r428109: Fix for racing conditions between stream finalizers and file removal 
(JAMES-584)
(Tests fixes not backported yet, will be committed later with lineending fixes)

Modified:
    james/server/branches/v2.3/src/java/org/apache/james/James.java
    
james/server/branches/v2.3/src/java/org/apache/james/transport/JamesSpoolManager.java
    
james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
    
james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/ToMultiRepository.java

Modified: james/server/branches/v2.3/src/java/org/apache/james/James.java
URL: 
http://svn.apache.org/viewvc/james/server/branches/v2.3/src/java/org/apache/james/James.java?rev=428557&r1=428556&r2=428557&view=diff
==============================================================================
--- james/server/branches/v2.3/src/java/org/apache/james/James.java (original)
+++ james/server/branches/v2.3/src/java/org/apache/james/James.java Thu Aug  3 
15:56:47 2006
@@ -23,6 +23,7 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
+import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.context.DefaultContext;
@@ -448,6 +449,7 @@
         MailImpl mail = new MailImpl(getId(), sender, recipients, message);
         mail.setState(state);
         sendMail(mail);
+        ContainerUtil.dispose(mail);
     }
 
     /**
@@ -679,6 +681,7 @@
         //Send it off ... with null reverse-path
         reply.setSender(null);
         sendMail(reply);
+        ContainerUtil.dispose(reply);
     }
 
     /**
@@ -872,5 +875,6 @@
         recipients.add(recipient); 
         MailImpl m = new MailImpl(getId(),sender,recipients,msg);
         localDeliveryMailet.service(m);
+        ContainerUtil.dispose(m);
     }
 }

Modified: 
james/server/branches/v2.3/src/java/org/apache/james/transport/JamesSpoolManager.java
URL: 
http://svn.apache.org/viewvc/james/server/branches/v2.3/src/java/org/apache/james/transport/JamesSpoolManager.java?rev=428557&r1=428556&r2=428557&view=diff
==============================================================================
--- 
james/server/branches/v2.3/src/java/org/apache/james/transport/JamesSpoolManager.java
 (original)
+++ 
james/server/branches/v2.3/src/java/org/apache/james/transport/JamesSpoolManager.java
 Thu Aug  3 15:56:47 2006
@@ -22,6 +22,7 @@
 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.container.ContainerUtil;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.DefaultServiceManager;
 import org.apache.avalon.framework.service.ServiceException;
@@ -309,12 +310,13 @@
                 if ((Mail.GHOST.equals(mail.getState())) ||
                     (mail.getRecipients() == null) ||
                     (mail.getRecipients().size() == 0)) {
+                    ContainerUtil.dispose(mail);
                     spool.remove(key);
                     if (getLogger().isDebugEnabled()) {
                         StringBuffer debugBuffer =
                             new StringBuffer(64)
                                     .append("==== Removed from spool mail ")
-                                    .append(mail.getName())
+                                    .append(key)
                                     .append("====");
                         getLogger().debug(debugBuffer.toString());
                     }
@@ -324,6 +326,7 @@
                     // message so that other threads can work on it!  If
                     // we don't remove it, we must unlock it!
                     spool.store(mail);
+                    ContainerUtil.dispose(mail);
                     spool.unlock(key);
                     // Do not notify: we simply updated the current mail
                     // and we are able to reprocess it now.

Modified: 
james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
URL: 
http://svn.apache.org/viewvc/james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/RemoteDelivery.java?rev=428557&r1=428556&r2=428557&view=diff
==============================================================================
--- 
james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
 (original)
+++ 
james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
 Thu Aug  3 15:56:47 2006
@@ -19,6 +19,7 @@
 
 import org.apache.avalon.cornerstone.services.store.Store;
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
+import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.james.Constants;
@@ -1104,10 +1105,12 @@
                         }
                         if (deliver(mail, session)) {
                             //Message was successfully delivered/fully 
failed... delete it
+                            ContainerUtil.dispose(mail);
                             outgoing.remove(key);
                         } else {
                             //Something happened that will delay delivery.  
Store any updates
                             outgoing.store(mail);
+                            ContainerUtil.dispose(mail);
                             // This is an update, we have to unlock and notify 
or this mail
                             // is kept locked by this thread
                             outgoing.unlock(key);
@@ -1124,6 +1127,7 @@
                         // DO NOT CHNANGE THIS to catch Error!  For example, 
if there were an OutOfMemory condition
                         // caused because something else in the server was 
abusing memory, we would not want to
                         // start purging the outgoing spool!
+                        ContainerUtil.dispose(mail);
                         outgoing.remove(key);
                         throw e;
                     }

Modified: 
james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/ToMultiRepository.java
URL: 
http://svn.apache.org/viewvc/james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/ToMultiRepository.java?rev=428557&r1=428556&r2=428557&view=diff
==============================================================================
--- 
james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/ToMultiRepository.java
 (original)
+++ 
james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/ToMultiRepository.java
 Thu Aug  3 15:56:47 2006
@@ -19,6 +19,7 @@
 
 import org.apache.avalon.cornerstone.services.store.Store;
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
+import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.james.Constants;
@@ -224,6 +225,7 @@
             throw new MessagingException(errorBuffer.toString());
         }
         userInbox.store(mail);
+        ContainerUtil.dispose(mail);
     }
 
     /**



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

Reply via email to