You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by MARTELLI Julien <jm...@softwaymedical.fr> on 2011/04/22 17:26:05 UTC
CXF Thread
Hi all,
I am wondering how CXF manages a Web Service call execution.
Is there a creation of a new Thread or is it executed in the current Thread= ?
Based on my tests I think it's executed in the current Thread but maybe the= re is a specific situation in which CXF creates a new Thread for the execut= ion.
I am concerned about this because I have a custom interceptor that uses a T= hreadLocal instance in order for the caller to retrieve some information af= ter the call is done. If the execution occurs in the same Thread this solut= ion works just fine which is not the case if a new Thread is created.
Thanks in advance for your help.
J.
RE: CXF Thread
Posted by MARTELLI Julien <jm...@softwaymedical.fr>.
Thanks for your response.
> The better option is to store values on the Message that is passed to the
> interceptor. It's just a property map. The implementation can then grab it
> directly from an injected WebServiceContext (if using JAX-WS) or via
> PhaseInterceptorChain.getCurrentMessage().
Actually I am using a ThreadLocal to be able to retrieve information generated by the interceptor once the call to the Web Service has been done.
Once the call is done I don't have access to the Message anymore.
-----Message d'origine-----
De : Daniel Kulp [mailto:dkulp@apache.org]
Envoyé : vendredi 22 avril 2011 18:05
À : users@cxf.apache.org
Cc : MARTELLI Julien
Objet : Re: CXF Thread
On Friday 22 April 2011 11:26:05 AM MARTELLI Julien wrote:
> Hi all,
>
> I am wondering how CXF manages a Web Service call execution.
>
> Is there a creation of a new Thread or is it executed in the current
> Thread= ?
Most of the time it's the current thread, but in the case of one-ways and
sometimes some of the WS-RM/A scenarios, it could change to a different
thread.
> Based on my tests I think it's executed in the current Thread but maybe
> the= re is a specific situation in which CXF creates a new Thread for the
> execut= ion.
>
> I am concerned about this because I have a custom interceptor that uses a
> T= hreadLocal instance in order for the caller to retrieve some
> information af= ter the call is done. If the execution occurs in the same
> Thread this solut= ion works just fine which is not the case if a new
> Thread is created.
The better option is to store values on the Message that is passed to the
interceptor. It's just a property map. The implementation can then grab it
directly from an injected WebServiceContext (if using JAX-WS) or via
PhaseInterceptorChain.getCurrentMessage().
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com
Re: CXF Thread
Posted by Daniel Kulp <dk...@apache.org>.
On Friday 22 April 2011 11:26:05 AM MARTELLI Julien wrote:
> Hi all,
>
> I am wondering how CXF manages a Web Service call execution.
>
> Is there a creation of a new Thread or is it executed in the current
> Thread= ?
Most of the time it's the current thread, but in the case of one-ways and
sometimes some of the WS-RM/A scenarios, it could change to a different
thread.
> Based on my tests I think it's executed in the current Thread but maybe
> the= re is a specific situation in which CXF creates a new Thread for the
> execut= ion.
>
> I am concerned about this because I have a custom interceptor that uses a
> T= hreadLocal instance in order for the caller to retrieve some
> information af= ter the call is done. If the execution occurs in the same
> Thread this solut= ion works just fine which is not the case if a new
> Thread is created.
The better option is to store values on the Message that is passed to the
interceptor. It's just a property map. The implementation can then grab it
directly from an injected WebServiceContext (if using JAX-WS) or via
PhaseInterceptorChain.getCurrentMessage().
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com