Return-Path: Delivered-To: apmail-incubator-cxf-issues-archive@locus.apache.org Received: (qmail 64825 invoked from network); 31 Jan 2008 22:39:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Jan 2008 22:39:29 -0000 Received: (qmail 5227 invoked by uid 500); 31 Jan 2008 22:39:20 -0000 Delivered-To: apmail-incubator-cxf-issues-archive@incubator.apache.org Received: (qmail 5218 invoked by uid 500); 31 Jan 2008 22:39:20 -0000 Mailing-List: contact cxf-issues-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: cxf-dev@incubator.apache.org Delivered-To: mailing list cxf-issues@incubator.apache.org Received: (qmail 5209 invoked by uid 99); 31 Jan 2008 22:39:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Jan 2008 14:39:20 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Jan 2008 22:39:01 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id A3A5571403F for ; Thu, 31 Jan 2008 14:39:08 -0800 (PST) Message-ID: <22301080.1201819148664.JavaMail.jira@brutus> Date: Thu, 31 Jan 2008 14:39:08 -0800 (PST) From: "Daniel Kulp (JIRA)" To: cxf-issues@incubator.apache.org Subject: [jira] Commented: (CXF-1410) Allow thread safe access to proxy with requestContext usage.. In-Reply-To: <10088246.1201704518783.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CXF-1410?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564530#action_12564530 ] Daniel Kulp commented on CXF-1410: ---------------------------------- Gary, There is a problem with your patch in that it doesn't work for the normal case of: Thread1- deployer thread or something configures the URL on the context Thread2 then makes an invokation without calling getRequestContext() at all. In your case, no context values are copied at all as the call to getThreadRequestContext() creates a new, unitialized hashmap. Second issue: If thread 1 in a thread pool configures some stuff in the request context and makes a request Then thread 2 in a thread pool re-configures some stuff. Then another request is made on thread 1 again, it won't see anything reconfigured by thread 2. What I think needs to happen is that the ThreadLocal requetcontext needs to be set back to null after the invoke. That might make using the contexts a bit more expensive though. I'll play around a little bit more tomorrow. > Allow thread safe access to proxy with requestContext usage.. > ------------------------------------------------------------- > > Key: CXF-1410 > URL: https://issues.apache.org/jira/browse/CXF-1410 > Project: CXF > Issue Type: Improvement > Components: JAX-WS Runtime > Affects Versions: 2.0.4 > Reporter: Gary Tully > Priority: Minor > Attachments: mt_context.patch > > > It should be possible to cache a proxy and provide thread safe access to it. For example, the following code should work from multiple threads with deterministic results: > Greeter greeter = // get cached proxy > InvocationHandler handler = Proxy.getInvocationHandler(greeter); > Map requestContext = ((BindingProvider)handler).getRequestContext(); > String threadSpecificaddress = // ... > requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, threadSpecificaddress); > the proposal is to implement thread local request contexts and manage the mapping from shared proxy request contexts to the thread local.The synchronization point is on a call to getRequestContext. the return is a snapshot of the current shared proxy request context map. > The map is such that it will echo modifications into the shared map. But further modifications to teh shared map will not be visible to the calling thread until subsequent getRequestContext call is made. > In other words, an invoke works with a copy of the thread local context which takes into account modifications to the shared context at the time of the getRequestContextCall() -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.