cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1160775 - /cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
Date Tue, 23 Aug 2011 16:21:25 GMT
Author: dkulp
Date: Tue Aug 23 16:21:25 2011
New Revision: 1160775

URL: http://svn.apache.org/viewvc?rev=1160775&view=rev
Log:
[CXF-3750] More fixes for one-ways to make sure the stream is closed and
thus properly deleted

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java?rev=1160775&r1=1160774&r2=1160775&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/OneWayProcessorInterceptor.java
Tue Aug 23 16:21:25 2011
@@ -20,6 +20,7 @@
 package org.apache.cxf.interceptor;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.concurrent.Executor;
 import java.util.concurrent.RejectedExecutionException;
 import java.util.logging.Logger;
@@ -51,7 +52,21 @@ public class OneWayProcessorInterceptor 
     public OneWayProcessorInterceptor(String phase) {
         super(phase);
     }
-    
+    public void handleFault(Message message) {
+        if (message.getExchange().isOneWay() 
+            && !isRequestor(message)) {
+            //in a one way, if an exception is thrown, the stream needs to be closed
+            InputStream in = message.getContent(InputStream.class);
+            if (in != null) {
+                try {
+                    in.close();
+                } catch (IOException e) {
+                    //ignore
+                }
+            }
+            
+        }
+    }
     public void handleMessage(Message message) throws Fault {
         
         if (message.getExchange().isOneWay() 
@@ -90,10 +105,12 @@ public class OneWayProcessorInterceptor 
                 Conduit conduit = message.getExchange().getDestination()
                     .getBackChannel(message, null, null);
                 if (conduit != null) {
+                    message.getExchange().setInMessage(null);
                     //for a one-way, the back channel could be
                     //null if it knows it cannot send anything.
                     conduit.prepare(partial);
                     conduit.close(partial);
+                    message.getExchange().setInMessage(message);
                 }
             } catch (IOException e) {
                 //IGNORE



Mime
View raw message