Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CBB7F92E3 for ; Tue, 20 Mar 2012 16:28:13 +0000 (UTC) Received: (qmail 28755 invoked by uid 500); 20 Mar 2012 16:28:13 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 28712 invoked by uid 500); 20 Mar 2012 16:28:13 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 28705 invoked by uid 99); 20 Mar 2012 16:28:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Mar 2012 16:28:13 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Mar 2012 16:28:10 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id EDE4A238899C; Tue, 20 Mar 2012 16:27:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1302979 - in /cxf/branches/2.4.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:27:48 -0000 To: commits@cxf.apache.org From: ay@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120320162748.EDE4A238899C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ay Date: Tue Mar 20 16:27:48 2012 New Revision: 1302979 URL: http://svn.apache.org/viewvc?rev=1302979&view=rev Log: Merged revisions 1302966 via svn merge from https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes ........ r1302966 | ay | 2012-03-20 17:14:46 +0100 (Tue, 20 Mar 2012) | 9 lines 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.4.x-fixes/ (props changed) cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java Propchange: cxf/branches/2.4.x-fixes/ ('svn:mergeinfo' removed) Propchange: cxf/branches/2.4.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java?rev=1302979&r1=1302978&r2=1302979&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java (original) +++ cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Destination.java Tue Mar 20 16:27:48 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; @@ -136,8 +137,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.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java?rev=1302979&r1=1302978&r2=1302979&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java (original) +++ cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureInInterceptor.java Tue Mar 20 16:27:48 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.4.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.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java?rev=1302979&r1=1302978&r2=1302979&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java (original) +++ cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/RMMessage.java Tue Mar 20 16:27:48 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 int getSize() { - return content.size(); + return content != null ? content.size() : -1; } } Modified: cxf/branches/2.4.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.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java?rev=1302979&r1=1302978&r2=1302979&view=diff ============================================================================== --- cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java (original) +++ cxf/branches/2.4.x-fixes/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/persistence/jdbc/RMTxStore.java Tue Mar 20 16:27:48 2012 @@ -472,7 +472,9 @@ public class RMTxStore implements RMStor updateDestinationSequence(seq); - storeMessage(seq.getIdentifier(), msg, false); + if (msg.getCachedOutputStream() != null) { + storeMessage(seq.getIdentifier(), msg, false); + } commit(); @@ -490,7 +492,9 @@ public class RMTxStore implements RMStor updateSourceSequence(seq); - storeMessage(seq.getIdentifier(), msg, true); + if (msg.getCachedOutputStream() != null) { + storeMessage(seq.getIdentifier(), msg, true); + } commit();