You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Asankha C. Perera" <as...@wso2.com> on 2008/09/30 09:16:54 UTC
Checking if connections are stale with NIO
When using keep-alive connections, Apache Synapse needs to ensure that a
connection is not just about to be closed after the expiration of the
socket timeout. The HttpConnection.isStale() tells of the expensive -
but guaranteed way to make sure of this, by making a blocking call on
the socket. However, this is not possible when we are non-blocking, and
the NHttpConnectionBase does not do this full check.
Is this something that I have missed, or is this something we still have
to implement?
thanks
asankha
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: Checking if connections are stale with NIO
Posted by "Asankha C. Perera" <as...@wso2.com>.
Hi Oleg
Thanks for the reply.. I was going through the archives from about 2
years back as well, and saw a suggestion from you that we should expect
situations like this and retry at the higher levels, and now this makes
sense to me. We will handle this situation from within Synapse
thanks
asankha
Oleg Kalnichevski wrote:
> On Tue, Sep 30, 2008 at 12:46:54PM +0530, Asankha C. Perera wrote:
>
>> When using keep-alive connections, Apache Synapse needs to ensure that a
>> connection is not just about to be closed after the expiration of the
>> socket timeout. The HttpConnection.isStale() tells of the expensive -
>> but guaranteed way to make sure of this, by making a blocking call on
>> the socket. However, this is not possible when we are non-blocking, and
>> the NHttpConnectionBase does not do this full check.
>>
>> Is this something that I have missed, or is this something we still have
>> to implement?
>>
>> thanks
>> asankha
>>
>>
>
> Hi Asankha
>
> HttpConnection#isStale() is only applicable to blocking connections, as
> in the blocking I/O model there is no way to test if a socket is still
> valid on both sides other than performing a read operation on that
> socket. #isStale() is basically meaningless for NIO connections. I very
> much regret not having moved the method to a blocking I/O specific
> interface.
>
> Oleg
>
>
>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
>> For additional commands, e-mail: dev-help@hc.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>
>
Re: Checking if connections are stale with NIO
Posted by sebb <se...@gmail.com>.
On 01/10/2008, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Tue, Sep 30, 2008 at 12:46:54PM +0530, Asankha C. Perera wrote:
> > When using keep-alive connections, Apache Synapse needs to ensure that a
> > connection is not just about to be closed after the expiration of the
> > socket timeout. The HttpConnection.isStale() tells of the expensive -
> > but guaranteed way to make sure of this, by making a blocking call on
> > the socket. However, this is not possible when we are non-blocking, and
> > the NHttpConnectionBase does not do this full check.
> >
> > Is this something that I have missed, or is this something we still have
> > to implement?
> >
> > thanks
> > asankha
> >
>
>
> Hi Asankha
>
> HttpConnection#isStale() is only applicable to blocking connections, as
> in the blocking I/O model there is no way to test if a socket is still
> valid on both sides other than performing a read operation on that
> socket. #isStale() is basically meaningless for NIO connections. I very
> much regret not having moved the method to a blocking I/O specific
> interface.
>
Perhaps override it in NIO to throw an IllegalOperation exception?
> Oleg
>
>
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> > For additional commands, e-mail: dev-help@hc.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org
Re: Checking if connections are stale with NIO
Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, Sep 30, 2008 at 12:46:54PM +0530, Asankha C. Perera wrote:
> When using keep-alive connections, Apache Synapse needs to ensure that a
> connection is not just about to be closed after the expiration of the
> socket timeout. The HttpConnection.isStale() tells of the expensive -
> but guaranteed way to make sure of this, by making a blocking call on
> the socket. However, this is not possible when we are non-blocking, and
> the NHttpConnectionBase does not do this full check.
>
> Is this something that I have missed, or is this something we still have
> to implement?
>
> thanks
> asankha
>
Hi Asankha
HttpConnection#isStale() is only applicable to blocking connections, as
in the blocking I/O model there is no way to test if a socket is still
valid on both sides other than performing a read operation on that
socket. #isStale() is basically meaningless for NIO connections. I very
much regret not having moved the method to a blocking I/O specific
interface.
Oleg
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org