cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [2/3] git commit: Save the retransmitChain per endpoint, not in the manager, as each endpoint may have a different chain
Date Thu, 13 Mar 2014 19:29:36 GMT
Save the retransmitChain per endpoint, not in the manager, as each endpoint may have a different
chain


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/aa383403
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/aa383403
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/aa383403

Branch: refs/heads/master
Commit: aa3834037a647154850de57a9fdacb1d7a44e219
Parents: 6646546
Author: Daniel Kulp <dkulp@apache.org>
Authored: Thu Mar 13 12:56:29 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Thu Mar 13 15:29:26 2014 -0400

----------------------------------------------------------------------
 .../cxf/ws/rm/RMCaptureOutInterceptor.java      |  4 ++--
 .../java/org/apache/cxf/ws/rm/RMManager.java    | 22 +++++++++++++-------
 .../cxf/ws/rm/soap/RetransmissionQueueImpl.java |  2 +-
 3 files changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/aa383403/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureOutInterceptor.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureOutInterceptor.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureOutInterceptor.java
index 34a248c..1de2687 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureOutInterceptor.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMCaptureOutInterceptor.java
@@ -200,13 +200,13 @@ public class RMCaptureOutInterceptor extends AbstractRMInterceptor<Message>
 {
             }
         }
         
-        // capture message if retranmission possible
+        // capture message if retransmission possible
         if (isApplicationMessage && !isPartialResponse) {
             getManager().initializeInterceptorChain(msg);
             captureMessage(msg);
         }
     }
-
+    
     private void captureMessage(Message message) {
         Message capture = new MessageImpl();
         capture.setId(message.getId());

http://git-wip-us.apache.org/repos/asf/cxf/blob/aa383403/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
index eb12610..a3ceb09 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMManager.java
@@ -105,6 +105,7 @@ public class RMManager {
     public static final String WSRM_ACKNOWLEDGEMENT_INTERVAL_PROPERTY = "org.apache.cxf.ws.rm.acknowledgement-interval";
 
     private static final Logger LOG = LogUtils.getL7dLogger(RMManager.class);
+    private static final String WSRM_RETRANSMIT_CHAIN = RMManager.class.getName() + ".retransmitChain";
 
 
     private Bus bus;
@@ -118,7 +119,6 @@ public class RMManager {
     private DestinationPolicyType destinationPolicy;
     private InstrumentationManager instrumentationManager;
     private ManagedRMManager managedManager;
-    private PhaseInterceptorChain retransmitChain;
     
     // ServerLifeCycleListener
     
@@ -725,10 +725,14 @@ public class RMManager {
      * @param msg
      */
     public void initializeInterceptorChain(Message msg) {
-        if (retransmitChain == null) {
-            LOG.info("Setting retransmit chain from message");
-            PhaseInterceptorChain chain = (PhaseInterceptorChain)msg.getInterceptorChain();
-            retransmitChain = chain.cloneChain();
+        Endpoint ep = msg.getExchange().getEndpoint();
+        synchronized (ep) {
+            if (ep.get(WSRM_RETRANSMIT_CHAIN) == null) {
+                LOG.info("Setting retransmit chain from message");
+                PhaseInterceptorChain chain = (PhaseInterceptorChain)msg.getInterceptorChain();
+                chain = chain.cloneChain();
+                ep.put(WSRM_RETRANSMIT_CHAIN, chain);
+            }
         }
     }
     
@@ -737,10 +741,12 @@ public class RMManager {
      * 
      * @return chain (<code>null</code> if none set)
      */
-    public PhaseInterceptorChain getRetransmitChain() {
-        if (retransmitChain == null) {
+    public PhaseInterceptorChain getRetransmitChain(Message msg) {
+        Endpoint ep = msg.getExchange().getEndpoint();
+        PhaseInterceptorChain pic = (PhaseInterceptorChain)ep.get(WSRM_RETRANSMIT_CHAIN);
+        if (pic == null) {
             return null;
         }
-        return retransmitChain.cloneChain();
+        return pic.cloneChain();
     }
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/aa383403/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
----------------------------------------------------------------------
diff --git a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
index 48281c4..a3a9899 100644
--- a/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
+++ b/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
@@ -727,7 +727,7 @@ public class RetransmissionQueueImpl implements RetransmissionQueue {
         try {
             
             // initialize copied interceptor chain for message
-            PhaseInterceptorChain retransmitChain = manager.getRetransmitChain();
+            PhaseInterceptorChain retransmitChain = manager.getRetransmitChain(message);
             ProtocolVariation protocol = RMContextUtils.getProtocolVariation(message);
             Endpoint endpoint = manager.getReliableEndpoint(message).getEndpoint(protocol);
             PhaseChainCache cache = new PhaseChainCache();


Mime
View raw message