hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruwan Linton <ruwan.lin...@gmail.com>
Subject Re: Closing the persisted server connections on IOReactor pause
Date Thu, 22 Apr 2010 10:40:51 GMT
Oleg,

I wrote the code, expecting that the IOControl#requestOutput will be calling
the NhttpServiceHandler#outputReady method or the
NhttpServiceHandler#responseReady method, but non of those get called?

Do you have any clue or is it a different method that I should be expected
be calling by the IOReactor??

Thanks,
Ruwan

On Sun, Apr 18, 2010 at 7:51 PM, Ruwan Linton <ruwan.linton@gmail.com>wrote:

>
>
> On Sun, Apr 18, 2010 at 4:17 PM, Oleg Kalnichevski <olegk@apache.org>wrote:
>
>> On Sun, 2010-04-18 at 08:00 +0530, Ruwan Linton wrote:
>> > Hi Oleg,
>> >
>> >
>> > > Hi Ruwan
>> > >
>> > > You have got to be very careful here. HTTP connection objects are not
>> > > thread safe! One can easily run into a race condition when interacting
>> > > with connection objects from any other but an I/O dispatch thread.
>> > >
>> >
>> > I have already encountered the above issue, and had a look at the
>> > NhttpConnection class JavaDoc and realized this.
>> >
>> >
>> > >
>> > > So, Here is the recommended way of going about this problem. You
>> should
>> > > signal the intention to terminate the connection by setting a special
>> > > attribute in the session context or changing the state of the shared
>> > > connection state object and let the connection shut down itself, when
>> it
>> > > is done processing the actual message.
>> >
>> >
>> > Thanks a lot for this valuable input, I was thinking how I can proceed
>> with
>> > my limited knowledge on httpcore. Really appreciate this help.
>> >
>> >
>> > > If the persistent connection is
>> > > idle, you may need to active it by using the IOControl interface.
>> > >
>> >
>> > May be I didn't get this part, could you please tell me how to check
>> whether
>> > the connection is idle or not?
>> >
>>
>> Hi Ruwan
>>
>> There is simply no reliable way to test that. By the time you are done
>> checking, the connection may finish message processing and become idle.
>> So, what you should do it to update the connection state (for instance,
>> in this particular case, by setting a termination request flag),
>> activate the connection by requesting output processing with
>> IOControl#requestOutput and let the connection react to the changed
>> state.
>>
>> Hope this helps
>>
>
> Of course, this helps a lot.
>
> I will get back to you with the status of my work, as soon as I am done
> with it, or will post any issues I get along the path.
>
> Thanks a lot for the excellent help.
>
> Ruwan
>
>
>>
>> Oleg
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
>> For additional commands, e-mail: dev-help@hc.apache.org
>>
>>
>
>
> --
> Ruwan Linton
> Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
> WSO2 Inc.; http://wso2.org
> email: ruwan@wso2.com; cell: +94 77 341 3097
> blog: http://ruwansblog.blogspot.com
>



-- 
Ruwan Linton
Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb
WSO2 Inc.; http://wso2.org
email: ruwan@wso2.com; cell: +94 77 341 3097
blog: http://ruwansblog.blogspot.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message