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 no...@apache.org on 2010/03/29 21:14:15 UTC

svn commit: r928874 - in /james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel: AbstractProcessorRouteBuilder.java DisposeProcessor.java

Author: norman
Date: Mon Mar 29 19:14:15 2010
New Revision: 928874

URL: http://svn.apache.org/viewvc?rev=928874&view=rev
Log:
Get sure we dispose Mail on stop()

Added:
    james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel/DisposeProcessor.java
Modified:
    james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel/AbstractProcessorRouteBuilder.java

Modified: james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel/AbstractProcessorRouteBuilder.java
URL: http://svn.apache.org/viewvc/james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel/AbstractProcessorRouteBuilder.java?rev=928874&r1=928873&r2=928874&view=diff
==============================================================================
--- james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel/AbstractProcessorRouteBuilder.java (original)
+++ james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel/AbstractProcessorRouteBuilder.java Mon Mar 29 19:14:15 2010
@@ -87,7 +87,7 @@ public abstract class AbstractProcessorR
     public void configure() throws Exception {
 
         Processor terminatingMailetProcessor = new MailetProcessor(new TerminatingMailet(), logger);
-
+        Processor disposeProcessor = new DisposeProcessor();
         
         List<HierarchicalConfiguration> processorConfs = config.configurationsAt("processor");
         for (int i = 0; i < processorConfs.size(); i++) {
@@ -213,8 +213,8 @@ public abstract class AbstractProcessorR
                             
                             .choice()
                
-                            // if the mailstate is GHOST whe should just stop here.
-                            .when(new MailStateEquals(Mail.GHOST)).stop()
+                            // if the mailstate is GHOST whe should just dispose and stop here.
+                            .when(new MailStateEquals(Mail.GHOST)).process(disposeProcessor).stop()
                              
                             // check if the state of the mail is the same as the
                             // current processor. If not just route it to the right endpoint via recipientList and stop processing.

Added: james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel/DisposeProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel/DisposeProcessor.java?rev=928874&view=auto
==============================================================================
--- james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel/DisposeProcessor.java (added)
+++ james/server/trunk/spoolmanager/src/main/java/org/apache/james/transport/camel/DisposeProcessor.java Mon Mar 29 19:14:15 2010
@@ -0,0 +1,37 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.transport.camel;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.james.lifecycle.LifecycleUtil;
+
+/**
+ * Processor which dispose body object if needed
+ * 
+ *
+ */
+public class DisposeProcessor implements Processor{
+
+	public void process(Exchange arg0) throws Exception {
+		LifecycleUtil.dispose(arg0.getIn().getBody());
+	}
+
+}



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