cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject cxf git commit: [CXF-6160] The JAX-RS frontend requires updates/changes to the exchange from multiple threads concurrently to support the AsyncResponse stuff. Change the Exchange to have a thread safe map.
Date Wed, 17 Dec 2014 18:09:28 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 01e3fff05 -> 52bee2a6a


[CXF-6160] The JAX-RS frontend requires updates/changes to the exchange from multiple threads
concurrently to support the AsyncResponse stuff.  Change the Exchange to have a thread safe
map.


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

Branch: refs/heads/3.0.x-fixes
Commit: 52bee2a6a088f632e81d1e2444e0a9cb9e60e414
Parents: 01e3fff
Author: Daniel Kulp <dkulp@apache.org>
Authored: Wed Dec 17 12:17:08 2014 -0500
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Wed Dec 17 13:09:18 2014 -0500

----------------------------------------------------------------------
 .../org/apache/cxf/message/ExchangeImpl.java    | 36 +++++++++-----------
 1 file changed, 16 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/52bee2a6/core/src/main/java/org/apache/cxf/message/ExchangeImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/message/ExchangeImpl.java b/core/src/main/java/org/apache/cxf/message/ExchangeImpl.java
index 587b898..5ac10ca 100644
--- a/core/src/main/java/org/apache/cxf/message/ExchangeImpl.java
+++ b/core/src/main/java/org/apache/cxf/message/ExchangeImpl.java
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.message;
 
+import java.util.concurrent.ConcurrentHashMap;
+
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.Binding;
 import org.apache.cxf.endpoint.ConduitSelector;
@@ -30,7 +32,7 @@ import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.Session;
 
-public class ExchangeImpl extends StringMapImpl implements Exchange {
+public class ExchangeImpl extends ConcurrentHashMap<String, Object>  implements Exchange
{
     
     private static final long serialVersionUID = -3112077559217623594L;
     private Destination destination;
@@ -69,24 +71,6 @@ public class ExchangeImpl extends StringMapImpl implements Exchange {
         this.bindingOp = ex.bindingOp;
     }
 
-    /*
-    public <T> T get(Class<T> key) { 
-        if (key == Bus.class) {
-            return (T)bus;
-        } else if (key == Service.class) {
-            return (T)service;
-        } else if (key == Endpoint.class) {
-            return (T)endpoint;
-        } else if (key == BindingOperationInfo.class) {
-            return (T)bindingOp;
-        } else if (key == Binding.class) {
-            return (T)binding;
-        } else if (key == OperationInfo.class) {
-            return super.get(key);
-        }
-        return super.get(key);
-    }
-    */
     private void resetContextCaches() {
         if (inMessage != null) {
             inMessage.resetContextCache();
@@ -101,9 +85,17 @@ public class ExchangeImpl extends StringMapImpl implements Exchange {
             outFaultMessage.resetContextCache();
         }
     }
+    
+    public <T> T get(Class<T> key) {
+        return key.cast(get(key.getName()));
+    }
 
     public <T> void put(Class<T> key, T value) {
-        super.put(key, value);
+        if (value == null) {
+            super.remove(key);
+        } else {
+            super.put(key.getName(), value);
+        }
         if (key == Bus.class) {
             resetContextCaches();
             bus = (Bus)value;
@@ -119,6 +111,7 @@ public class ExchangeImpl extends StringMapImpl implements Exchange {
             binding = (Binding)value;
         }
     }
+    
     public Object put(String key, Object value) {
         if (inMessage != null) {
             inMessage.setContextualProperty(key, value);
@@ -132,6 +125,9 @@ public class ExchangeImpl extends StringMapImpl implements Exchange {
         if (outFaultMessage != null) {
             outFaultMessage.setContextualProperty(key, value);
         }
+        if (value == null) {
+            return super.remove(key);
+        }
         return super.put(key, value);
     }
 


Mime
View raw message