Hi James
On 22/11/16 15:17, James Carman wrote:
From the documentation, it says that:
"A single client doing multiple invocations without changing the current
URI or headers is thread-safe."
Now, what happens if we have @HeaderParam in the API of the service? Does
that count as "changing headers", thereby making the client proxy not
thread-safe?
Only if you cast a proxy to WebClient and set headers there before doing
the request then a value of a given header can be affected in a
non-thread safe flow
Also, there is mention of:
"Final option is to use a 'threadSafe' boolean property when creating
proxies or web clients (either from Spring or programmatically), see this
test
<http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultithreadedClientTest.java>
for more details. Thread-safe clients created this way keep their state in
a thread-local storage."
I don't see any setting of a "threadSafe" boolean property in that test:
http://svn.apache.org/repos/asf/cxf/trunk/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultithreadedClientTest.java
Where would I set that "threadSafe" property in order to force the proxy to
use ThreadLocal storage for its state?
There a WebClient copy constructor is used. 'threadSafe' can be set on
JAXRSClientFactoryBean
Has anyone already implemented a dynamic proxy that creates a new
proxy (WebClient.fromClient
or JAXRSClientFactoryBean.fromClient) internally for every call?
CXF JAX-RS 2.0 code uses WebClient internally and it uses
WebClient.fromClient, I may've used it in some diff code too
Thanks, Sergey
Thanks,
James
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/