Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Are JAX-WS client proxies thread safe?

client jax-ws proxies safe thread
0
Posted

Are JAX-WS client proxies thread safe?

0

Official JAX-WS answer: No. According to the JAX-WS spec, the client proxies are NOT thread safe. To write portable code, you should treat them as non-thread safe and synchronize access or use a pool of instances or similar. CXF answer: CXF proxies are thread safe for MANY use cases. The exceptions are: • Use of ((BindingProvider)proxy).getRequestContext() – per JAX-WS spec, the request context is PER INSTANCE. Thus, anything set there will affect requests on other threads. With CXF, you can do: ((BindingProvider)proxy).getRequestContext().put(“thread.local.request.context”, “true”); and future calls to getRequestContext() will use a thread local request context. That allows the request context to be threadsafe. (Note: the response context is always thread local in CXF) • Settings on the conduit – if you use code or configuration to directly manipulate the conduit (like to set TLS settings or similar), those are not thread safe. The conduit is per-instance and thus those settings would

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123