You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Konstantin Kolinko <kn...@gmail.com> on 2011/09/10 01:11:11 UTC

In 7.0: sendfileInProgress flag in breakKeepAliveLoop() - difference in Nio vs. Apr

Reviewing #breakKeepAliveLoop() method in Http11 implementations in 7.0.x,
there is a difference between Nio and Apr:

I see that Http11NioProcessor does not update
AbstractHttp11Processor#sendfileInProgress flag, but Apr processor
does set it to "true".

Is this difference in #breakKeepAliveLoop() implementations intended?

JavaDoc says that the sendfileInProgress flag is used to indicate "that the
* socket should not be returned to the poller (where a poller is used)."
and I understand that both of them use pollers.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: In 7.0: sendfileInProgress flag in breakKeepAliveLoop() - difference in Nio vs. Apr

Posted by ma...@apache.org.
Going from memory rather than looking at the code that I don't have easy access to right now...

Konstantin Kolinko <kn...@gmail.com> wrote:

>Reviewing #breakKeepAliveLoop() method in Http11 implementations in
>7.0.x,
>there is a difference between Nio and Apr:
>
>I see that Http11NioProcessor does not update
>AbstractHttp11Processor#sendfileInProgress flag, but Apr processor
>does set it to "true".
>
>Is this difference in #breakKeepAliveLoop() implementations intended?

Yes.

>JavaDoc says that the sendfileInProgress flag is used to indicate "that
>the
>* socket should not be returned to the poller (where a poller is
>used)."
>and I understand that both of them use pollers.

Both NIO and APR use polling but in different ways. They handle the following questions (BIO is different again) differently:
- time out when reading directly from the socket
- time out when in the poller
- use keep alive or not
- when returning from the processor, should the socket be added to the pollers (very similar to previous point)

Broadly, APR uses the return value and a few flags on the processor to control this whereas NIO uses the socket wrapper to set things directly.

I'm sure there is scope for further refactoring that reduces the differences further and removes the need for some of these flags. That is on my todo list but WebSockets is next now I have the bulk of the HTTP processing in a common base class.

Mark





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org