You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Rice Yeh <ri...@gmail.com> on 2011/12/09 19:19:21 UTC

Many threads serve a http request in cxf

Hi,
  I just find that there are many threads serve a http request. My case
jaxrs and I find that threads running the interceptor.handleMessage,
resource code, interceptor.handleFault and exception mapper are not same.
This makes thread local variables cannot be used for transferring
information among them. Is there a way to make them all run by the same
thread?

Rice

Re: Many threads serve a http request in cxf

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 13/12/11 06:30, Rice Yeh wrote:
> I am using JAXRS and I have solved the problem by overriding JAXRSInvoker
> instead of having thread local variables initialized in another interceptor.

did you use your own ThreadLocal storage ?
PhaseIntereceptorChain will always give you the current Message and you 
can get to message.getExchange() - setting properties on Exchange will 
make the available for for in/out interceptors for the duration of requests.

Cheers, Sergey

>
> Thanks,
> Rice
>
> On Sun, Dec 11, 2011 at 1:06 AM, Sergey Beryozkin<sb...@gmail.com>wrote:
>
>> Hi
>>
>> On 09/12/11 18:19, Rice Yeh wrote:
>>
>>> Hi,
>>>    I just find that there are many threads serve a http request. My case
>>> jaxrs and I find that threads running the interceptor.handleMessage,
>>> resource code, interceptor.handleFault and exception mapper are not same.
>>> This makes thread local variables cannot be used for transferring
>>> information among them. Is there a way to make them all run by the same
>>> thread?
>>>
>>>   If it were the case we'd leak contexts on every request; so before you
>> can assert CXF leaks local variables :-) lets try to find out what is
>> actually happening; do you have a server app acting as a client and the
>> client part needs to get some context info available to the server ?
>>
>> Cheers, Sergey
>>
>>   Rice
>>>
>>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>> Blog: http://sberyozkin.blogspot.com
>>
>

Re: Many threads serve a http request in cxf

Posted by Rice Yeh <ri...@gmail.com>.
I am using JAXRS and I have solved the problem by overriding JAXRSInvoker
instead of having thread local variables initialized in another interceptor.

Thanks,
Rice

On Sun, Dec 11, 2011 at 1:06 AM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi
>
> On 09/12/11 18:19, Rice Yeh wrote:
>
>> Hi,
>>   I just find that there are many threads serve a http request. My case
>> jaxrs and I find that threads running the interceptor.handleMessage,
>> resource code, interceptor.handleFault and exception mapper are not same.
>> This makes thread local variables cannot be used for transferring
>> information among them. Is there a way to make them all run by the same
>> thread?
>>
>>  If it were the case we'd leak contexts on every request; so before you
> can assert CXF leaks local variables :-) lets try to find out what is
> actually happening; do you have a server app acting as a client and the
> client part needs to get some context info available to the server ?
>
> Cheers, Sergey
>
>  Rice
>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>

Re: Many threads serve a http request in cxf

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 09/12/11 18:19, Rice Yeh wrote:
> Hi,
>    I just find that there are many threads serve a http request. My case
> jaxrs and I find that threads running the interceptor.handleMessage,
> resource code, interceptor.handleFault and exception mapper are not same.
> This makes thread local variables cannot be used for transferring
> information among them. Is there a way to make them all run by the same
> thread?
>
If it were the case we'd leak contexts on every request; so before you 
can assert CXF leaks local variables :-) lets try to find out what is 
actually happening; do you have a server app acting as a client and the 
client part needs to get some context info available to the server ?

Cheers, Sergey

> Rice
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com