cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6774] Checking a thread.safe.client property
Date Mon, 15 Feb 2016 11:53:33 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 42551a19a -> 89e4e97a4


[CXF-6774] Checking a thread.safe.client property


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

Branch: refs/heads/3.0.x-fixes
Commit: 89e4e97a4c1589fc0951806f9587f33329233081
Parents: 42551a1
Author: Sergey Beryozkin <sberyozkin@gmail.com>
Authored: Mon Feb 15 11:50:53 2016 +0000
Committer: Sergey Beryozkin <sberyozkin@gmail.com>
Committed: Mon Feb 15 11:53:16 2016 +0000

----------------------------------------------------------------------
 .../org/apache/cxf/jaxrs/client/spec/ClientImpl.java     | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/89e4e97a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java
----------------------------------------------------------------------
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java
index cd440dc..316dd69 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/spec/ClientImpl.java
@@ -54,6 +54,7 @@ public class ClientImpl implements Client {
     private static final String HTTP_PROXY_SERVER_PORT_PROP = "http.proxy.server.port";
     private static final String HTTP_AUTOREDIRECT_PROP = "http.autoredirect";
     private static final String HTTP_RESPONSE_AUTOCLOSE_PROP = "http.response.stream.auto.close";
+    private static final String THREAD_SAFE_CLIENT_PROP = "thread.safe.client";
     
     private Configurable<Client> configImpl;
     private TLSConfiguration secConfig;
@@ -242,8 +243,9 @@ public class ClientImpl implements Client {
         @Override
         public Builder request() {
             checkClosed();
+            Map<String, Object> configProps = getConfiguration().getProperties();
             
-            initTargetClientIfNeeded(); 
+            initTargetClientIfNeeded(configProps); 
             
             ClientProviderFactory pf = 
                 ClientProviderFactory.getInstance(WebClient.getConfig(targetClient).getEndpoint());
@@ -266,7 +268,6 @@ public class ClientImpl implements Client {
             }
             
             pf.setUserProviders(providers);
-            Map<String, Object> configProps = getConfiguration().getProperties();
             ClientConfiguration clientCfg = WebClient.getConfig(targetClient);
             
             clientCfg.getRequestContext().putAll(configProps);
@@ -318,11 +319,15 @@ public class ClientImpl implements Client {
             }
         }
 
-        private void initTargetClientIfNeeded() {
+        private void initTargetClientIfNeeded(Map<String, Object> configProps) {
             URI uri = uriBuilder.build();
             if (targetClient == null) {
                 JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
                 bean.setAddress(uri.toString());
+                Boolean threadSafe = getBooleanValue(configProps.get(THREAD_SAFE_CLIENT_PROP));
+                if (threadSafe != null) {
+                    bean.setThreadSafe(threadSafe);
+                }
                 targetClient = bean.createWebClient();
                 ClientImpl.this.baseClients.add(targetClient);
             } else if (!targetClient.getCurrentURI().equals(uri)) {


Mime
View raw message