Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4C0DE200B4B for ; Wed, 6 Jul 2016 15:50:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4B0EC160A64; Wed, 6 Jul 2016 13:50:13 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 71687160A74 for ; Wed, 6 Jul 2016 15:50:12 +0200 (CEST) Received: (qmail 96127 invoked by uid 500); 6 Jul 2016 13:50:11 -0000 Mailing-List: contact issues-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 issues@cxf.apache.org Received: (qmail 95796 invoked by uid 99); 6 Jul 2016 13:50:11 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jul 2016 13:50:11 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 3A5EC2C02A5 for ; Wed, 6 Jul 2016 13:50:11 +0000 (UTC) Date: Wed, 6 Jul 2016 13:50:11 +0000 (UTC) From: "RANADEEP SHARMA (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (CXF-6963) Setting ThreadLocal specific property on RequestContext is still not thread-safe MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 06 Jul 2016 13:50:13 -0000 RANADEEP SHARMA created CXF-6963: ------------------------------------ Summary: Setting ThreadLocal specific property on RequestContext is still not thread-safe Key: CXF-6963 URL: https://issues.apache.org/jira/browse/CXF-6963 Project: CXF Issue Type: Bug Components: JAX-WS Runtime Affects Versions: 3.1.6, 3.1.0 Environment: Redhat Enterprise Linux (Santiago), OpenJDK 7, Tomcat 7 Reporter: RANADEEP SHARMA Hi, I have a overridden factory for JaxWS proxy clients, as shown below. I created this class as per the link - http://cxf.apache.org/faq.html#FAQ%2DAreJAX%2DWSclientproxiesthreadsafe%3F. Here's the spring config -------------------------------- Here goes the classes -------------------------------- public class TSafeJaxWsProxyFactoryBean extends JaxWsProxyFactoryBean { public TSafeJaxWsProxyFactoryBean() { super(); } public TSafeJaxWsProxyFactoryBean(ClientFactoryBean fact) { super(fact); } @Override protected ClientProxy clientClientProxy(Client c) { ClientProxy clientProxy = super.clientClientProxy(c); clientProxy.getRequestContext().put("thread.local.request.context", "true"); return clientProxy; } } In my application, I have 2 methods that use the proxy created by the above factory. One method - getSessionInfo() populates the BindingProvider.ENDPOINT_ADDRESS_PROPERTY into the RequestContext before the service call. Another method - startSession() just calls service without populating above property. public class SessionManagerWrapperImpl { public SessionInfo startSession() { ... Map requestContext = ((BindingProvider) sessionManagerService).getRequestContext(); if(requestContext.containsKey(BindingProvider.ENDPOINT_ADDRESS_PROPERTY)) { requestContext.remove(BindingProvider.ENDPOINT_ADDRESS_PROPERTY); } ... // Make service call using 'sessionManagerService' ... } public SessionInfo getSessionInfo(String sessionId) { ((BindingProvider) sessionManagerService).getRequestContext() .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUri + ";jsessionid=" + sessionId); SessionInfo result = sessionManagerService.getSessionInfo(sessionId); } } Now, I am getting into a situation where RequestContext is already having the mentioned property for the thread processing startSession(). This is not expected, since CXF documentation claims the explained usage to be thread-safe. Please let me know if my understanding and implementation is correct. However, if my usage is correct, is there a possible bug in CXF? NOTE : i have already created a user thread - http://cxf.547215.n5.nabble.com/CXF-client-for-JaxWS-proxy-NOT-thread-safe-tt5770148.html -- This message was sent by Atlassian JIRA (v6.3.4#6332)