You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2018/10/22 18:55:39 UTC

[cxf] branch 3.2.x-fixes updated: No need for response context to not be static

This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch 3.2.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/3.2.x-fixes by this push:
     new 4da7b71  No need for response context to not be static
4da7b71 is described below

commit 4da7b71fd37ced7641b0c81a7bf9f3e7077cebd8
Author: Daniel Kulp <dk...@apache.org>
AuthorDate: Mon Oct 22 08:52:31 2018 -0400

    No need for response context to not be static
---
 .../src/main/java/org/apache/cxf/endpoint/ClientImpl.java | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
index 1506ade..eb2df49 100644
--- a/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
+++ b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
@@ -277,7 +277,7 @@ public class ClientImpl
     public Map<String, Object> getResponseContext() {
         if (!responseContext.containsKey(Thread.currentThread())) {
             final Thread t = Thread.currentThread();
-            responseContext.put(t, new ResponseContext());
+            responseContext.put(t, new ResponseContext(responseContext));
         }
         return responseContext.get(Thread.currentThread());
     }
@@ -287,7 +287,7 @@ public class ClientImpl
             responseContext.put(Thread.currentThread(), c);
             return c;
         }
-        ResponseContext c = new ResponseContext(ctx);
+        ResponseContext c = new ResponseContext(ctx, responseContext);
         responseContext.put(Thread.currentThread(), c);
         return c;
     }
@@ -476,7 +476,7 @@ public class ClientImpl
                 context.put(REQUEST_CONTEXT, reqContext);
             }
             if (resContext == null) {
-                resContext = new ResponseContext();
+                resContext = new ResponseContext(responseContext);
                 context.put(RESPONSE_CONTEXT, resContext);
             }
 
@@ -1083,16 +1083,19 @@ public class ClientImpl
      * Class to handle the response contexts.   The clear is overloaded to remove
      * this context from the threadLocal caches in the ClientImpl
      */
-    class ResponseContext implements Map<String, Object>, Serializable {
+    static class ResponseContext implements Map<String, Object>, Serializable {
         private static final long serialVersionUID = 2L;
         final Map<String, Object> wrapped;
+        final Map<Thread, ResponseContext> responseContext;
         
-        ResponseContext(Map<String, Object> origMap) {
+        ResponseContext(Map<String, Object> origMap, Map<Thread, ResponseContext> rc) {
             wrapped = origMap;
+            responseContext = rc;
         }
 
-        ResponseContext() {
+        ResponseContext(Map<Thread, ResponseContext> rc) {
             wrapped = new HashMap<>();
+            responseContext = rc;
         }
 
         @Override