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 759EB183E9 for ; Mon, 15 Feb 2016 11:53:34 +0000 (UTC) Received: (qmail 40921 invoked by uid 500); 15 Feb 2016 11:53:34 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 40861 invoked by uid 500); 15 Feb 2016 11:53:34 -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 40852 invoked by uid 99); 15 Feb 2016 11:53:34 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Feb 2016 11:53:34 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E5012E0A3C; Mon, 15 Feb 2016 11:53:33 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergeyb@apache.org To: commits@cxf.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: [CXF-6774] Checking a thread.safe.client property Date: Mon, 15 Feb 2016 11:53:33 +0000 (UTC) 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 Authored: Mon Feb 15 11:50:53 2016 +0000 Committer: Sergey Beryozkin 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 configImpl; private TLSConfiguration secConfig; @@ -242,8 +243,9 @@ public class ClientImpl implements Client { @Override public Builder request() { checkClosed(); + Map 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 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 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)) {