cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: jaxws client proxy questions [Virus checked]
Date Tue, 29 Apr 2008 17:29:06 GMT
On Tuesday 29 April 2008, jan.minaroviech@external.t-mobile.at wrote:
> Hello,
>
> could you help me to answer following (soap over http using
> jaxws+jaxb):
>
> 1) is client proxy thread-safe?

By default, no.  This is an issue with the JAX-WS spec as the request 
context is per-proxy so if you use the context for anything, it's not 
thread safe.   If you DON'T use the request context, it is threadsafe.

In CXF, the response context is always thread local, so that is safe.

With 2.0.6 and 2.1, we provide a property that you can set on the proxy 
to change the request context to a thread local.   If you do:

((BindingProvider)proxy).getRequestContext().put(
   "thread.local.request.context", Boolean.TRUE);

Then the NEXT call to getRequestContext() will flip it to a ThreadLocal 
and it would be completely threadsafe except for sessions which are 
always on a per-proxy basis.

> 2) how is it possible to change address for existing proxy? (want to
> change it multiple times in runtime)

((BindingProvider)proxy).getRequestContext().put(
   BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
   url);


-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Mime
View raw message