cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1302966 - in /cxf/branches/2.5.x-fixes: ./ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/ rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/
Date Tue, 20 Mar 2012 16:14:47 GMT
Author: ay
Date: Tue Mar 20 16:14:46 2012
New Revision: 1302966

URL: http://svn.apache.org/viewvc?rev=1302966&view=rev
Log:
Merged revisions 1300485 via  svn merge from
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1300485 | ay | 2012-03-14 10:40:00 +0100 (Wed, 14 Mar 2012) | 1 line
  
  improvement to CXF-4164 to utilize robust-mode to avoid persisting messages in ws-rm
........

Modified:
    cxf/branches/2.5.x-fixes/   (props changed)
    cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java
    cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java
    cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java
    cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java

Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java?rev=1302966&r1=1302965&r2=1302966&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java
Tue Mar 20 16:14:46 2012
@@ -33,6 +33,7 @@ import org.apache.cxf.io.CachedOutputStr
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.ws.addressing.AddressingPropertiesImpl;
 import org.apache.cxf.ws.rm.persistence.RMMessage;
@@ -145,8 +146,10 @@ public class Destination extends Abstrac
 
         RMStore store = getReliableEndpoint().getManager().getStore();
         if (null != store) {
-            CachedOutputStream saved = 
-                (CachedOutputStream)message.get(RMMessageConstants.SAVED_CONTENT);
+            CachedOutputStream saved = null;
+            if (!MessageUtils.isTrue(message.getContextualProperty(Message.ROBUST_ONEWAY)))
{
+                saved = (CachedOutputStream)message.get(RMMessageConstants.SAVED_CONTENT);
+            }
             RMMessage msg = new RMMessage();
             msg.setMessageNumber(sequenceType.getMessageNumber());
             msg.setContent(saved);

Modified: cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java?rev=1302966&r1=1302965&r2=1302966&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java
Tue Mar 20 16:14:46 2012
@@ -27,6 +27,7 @@ import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.io.CachedOutputStream;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 
 /**
@@ -41,23 +42,26 @@ public class RMCaptureInInterceptor exte
 
     protected void handle(Message message) throws SequenceFault, RMException {
         LOG.entering(getClass().getName(), "handleMessage");
-        
-        InputStream is = message.getContent(InputStream.class);
-        if (is != null) {
-            CachedOutputStream saved = new CachedOutputStream();
-            try {
-                IOUtils.copy(is, saved);
+        // This message capturing mechanism will need to be changed at some point.
+        // Until then, we keep this interceptor here and utilize the robust
+        // option to avoid the unnecessary message capturing/caching.
+        if (!MessageUtils.isTrue(message.getContextualProperty(Message.ROBUST_ONEWAY))) {
+            InputStream is = message.getContent(InputStream.class);
+            if (is != null) {
+                CachedOutputStream saved = new CachedOutputStream();
+                try {
+                    IOUtils.copy(is, saved);
 
-                saved.flush();
-                is.close();
+                    saved.flush();
+                    is.close();
 
-                message.setContent(InputStream.class, saved.getInputStream());
-                LOG.fine("Capturing the original RM message");
-                message.put(RMMessageConstants.SAVED_CONTENT, saved);
-            } catch (Exception e) {
-                throw new Fault(e);
+                    message.setContent(InputStream.class, saved.getInputStream());
+                    LOG.fine("Capturing the original RM message");
+                    message.put(RMMessageConstants.SAVED_CONTENT, saved);
+                } catch (Exception e) {
+                    throw new Fault(e);
+                }
             }
         }
     }
-
 }

Modified: cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java?rev=1302966&r1=1302965&r2=1302966&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java
Tue Mar 20 16:14:46 2012
@@ -55,7 +55,7 @@ public class RMMessage {
     public byte[] getContent() {
         byte[] bytes = null;
         try {
-            bytes = content.getBytes();
+            bytes = content != null ? content.getBytes() : null;
         } catch (IOException e) {
             // ignore and treat it as null
         }
@@ -120,7 +120,7 @@ public class RMMessage {
      * @throws IOException
      */
     public InputStream getInputStream() throws IOException {
-        return content.getInputStream();
+        return content != null ? content.getInputStream() : null;
     }
     
     /**
@@ -137,6 +137,6 @@ public class RMMessage {
      * @return
      */
     public long getSize() {
-        return content.size();
+        return content != null ? content.size() : -1L;
     }
 }

Modified: cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java?rev=1302966&r1=1302965&r2=1302966&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
(original)
+++ cxf/branches/2.5.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java
Tue Mar 20 16:14:46 2012
@@ -473,7 +473,9 @@ public class RMTxStore implements RMStor
             
             updateDestinationSequence(seq);
             
-            storeMessage(seq.getIdentifier(), msg, false);
+            if (msg.getCachedOutputStream() != null) {
+                storeMessage(seq.getIdentifier(), msg, false);
+            }
             
             commit();
             
@@ -491,7 +493,9 @@ public class RMTxStore implements RMStor
             
             updateSourceSequence(seq);
             
-            storeMessage(seq.getIdentifier(), msg, true);
+            if (msg.getCachedOutputStream() != null) {
+                storeMessage(seq.getIdentifier(), msg, true);
+            }
             
             commit();
             



Mime
View raw message