You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Rob Barrett <ba...@gmail.com> on 2008/02/07 19:16:47 UTC
CXF threading
Is it reasonable to use a ThreadLocal for holding request specific
metadata? i.e. are there cases where CXF can use more than one thread
to handle a request or where CXF handles more than one request on the
same thread?
Or does this just depend on the configuration of the container e.g.
tomcat/jetty?
If it's not a good thing to do then what is the preferred way to
attach metadata to a request?
Thanks Rob
Re: CXF threading
Posted by Daniel Kulp <dk...@apache.org>.
Right now, a threadlocal would work.
That said, ideally you would use the exchange for storage (for cxf
interceptors) or the WebServiceContext for the jaxws stuff. That way,
if we change things in the future, it wouldn't break. We keep talking
about someday allowing the interceptor chain to be paused and then
resumed on another thread. We're not there yet, but.....
Dan
On Thursday 07 February 2008, Rob Barrett wrote:
> Is it reasonable to use a ThreadLocal for holding request specific
> metadata? i.e. are there cases where CXF can use more than one thread
> to handle a request or where CXF handles more than one request on the
> same thread?
>
> Or does this just depend on the configuration of the container e.g.
> tomcat/jetty?
>
> If it's not a good thing to do then what is the preferred way to
> attach metadata to a request?
>
> Thanks Rob
--
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog
Re: CXF threading
Posted by Christian Vest Hansen <ka...@gmail.com>.
ThreadLocals should be safe. Once a thread has entered the scope of
one of your web service operation implementation methods, it can't be
preemptively dispatched to work on another request.
Most containers pool their threads, though, so the same thread might
handle multiple requests, but only one at any given time. Just keep
this in mind, and don't expect it to contain null at the beginning of
your request unless you explicitly clean it up like that.
On 2/7/08, Rob Barrett <ba...@gmail.com> wrote:
> Is it reasonable to use a ThreadLocal for holding request specific
> metadata? i.e. are there cases where CXF can use more than one thread
> to handle a request or where CXF handles more than one request on the
> same thread?
>
> Or does this just depend on the configuration of the container e.g.
> tomcat/jetty?
>
> If it's not a good thing to do then what is the preferred way to
> attach metadata to a request?
>
> Thanks Rob
>
--
Venlig hilsen / Kind regards,
Christian Vest Hansen.