cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1350633 - in /cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm: RMCaptureInInterceptor.java RetransmissionCallback.java persistence/jdbc/RMTxStore.java soap/RetransmissionQueueImpl.java
Date Fri, 15 Jun 2012 14:09:02 GMT
Author: ay
Date: Fri Jun 15 14:09:01 2012
New Revision: 1350633

URL: http://svn.apache.org/viewvc?rev=1350633&view=rev
Log:
[CXF-4383] Some temporary files are not deleted after WS-RM scenarios

Modified:
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
    cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java?rev=1350633&r1=1350632&r2=1350633&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java Fri
Jun 15 14:09:01 2012
@@ -54,6 +54,7 @@ public class RMCaptureInInterceptor exte
 
                     saved.flush();
                     is.close();
+                    saved.lockOutputStream();
 
                     message.setContent(InputStream.class, saved.getInputStream());
                     LOG.fine("Capturing the original RM message");

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java?rev=1350633&r1=1350632&r2=1350633&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java (original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RetransmissionCallback.java Fri
Jun 15 14:09:01 2012
@@ -48,6 +48,7 @@ public class RetransmissionCallback impl
         saved.holdTempFile();
         try {
             cos.writeCacheTo(saved);            
+            saved.lockOutputStream();
         } catch (IOException e) {
             // ignore
         }

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java?rev=1350633&r1=1350632&r2=1350633&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
(original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
Fri Jun 15 14:09:01 2012
@@ -733,16 +733,28 @@ public class RMTxStore implements RMStor
             LOG.log(Level.FINE, "Storing {0} message number {1} for sequence {2}, to = {3}",
                     new Object[] {outbound ? "outbound" : "inbound", nr, id, to});
         }
-        PreparedStatement stmt = outbound ? createOutboundMessageStmt : createInboundMessageStmt;
-        int i = 1;
-        stmt.setString(i++, id);  
-        stmt.setLong(i++, nr);
-        stmt.setString(i++, to); 
-        stmt.setBinaryStream(i++, msg.getInputStream(), (int)msg.getSize());
-        stmt.execute();
-        if (LOG.isLoggable(Level.FINE)) {
-            LOG.log(Level.FINE, "Successfully stored {0} message number {1} for sequence
{2}",
-                    new Object[] {outbound ? "outbound" : "inbound", nr, id});
+        InputStream msgin = null;
+        try {
+            msgin = msg.getInputStream();
+            PreparedStatement stmt = outbound ? createOutboundMessageStmt : createInboundMessageStmt;
+            int i = 1;
+            stmt.setString(i++, id);  
+            stmt.setLong(i++, nr);
+            stmt.setString(i++, to); 
+            stmt.setBinaryStream(i++, msgin, (int)msg.getSize());
+            stmt.execute();
+            if (LOG.isLoggable(Level.FINE)) {
+                LOG.log(Level.FINE, "Successfully stored {0} message number {1} for sequence
{2}",
+                        new Object[] {outbound ? "outbound" : "inbound", nr, id});
+            }
+        } finally  {
+            if (msgin != null) {
+                try {
+                    msgin.close();
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
         }
         
     }

Modified: cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java?rev=1350633&r1=1350632&r2=1350633&view=diff
==============================================================================
--- cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
(original)
+++ cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
Fri Jun 15 14:09:01 2012
@@ -659,6 +659,12 @@ public class RetransmissionQueueImpl imp
             CachedOutputStream saved = (CachedOutputStream)message.remove(RMMessageConstants.SAVED_CONTENT);
             if (saved != null) {
                 saved.releaseTempFileHold();
+                // call close to dispose
+                try {
+                    saved.close();
+                } catch (IOException e) {
+                    // ignore
+                }
             }
         }
 



Mime
View raw message