On Sun, Apr 18, 2010 at 4:17 PM, Oleg Kalnichevski <[email protected]> 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: [email protected] > For additional commands, e-mail: [email protected] > > -- Ruwan Linton Technical Lead & Product Manager; WSO2 ESB; http://wso2.org/esb WSO2 Inc.; http://wso2.org email: [email protected]; cell: +94 77 341 3097 blog: http://ruwansblog.blogspot.com
