tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: svn commit: r1360905 - /tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java
Date Thu, 12 Jul 2012 20:19:32 GMT
On 12/07/2012 21:11, fhanik@apache.org wrote:
> Author: fhanik
> Date: Thu Jul 12 20:11:31 2012
> New Revision: 1360905
> 
> URL: http://svn.apache.org/viewvc?rev=1360905&view=rev
> Log:
> Correct handling of timeout - negative or zero means no timeout but an instant

Nope. The expected and documented behaviour for a negative timeout for
all connectors is an infinite timeout.

Mark

> 
> 
> Modified:
>     tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java
> 
> Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java
> URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java?rev=1360905&r1=1360904&r2=1360905&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java (original)
> +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioSelectorPool.java Thu Jul 12 20:11:31
2012
> @@ -196,7 +196,11 @@ public class NioSelectorPool {
>                      //register OP_WRITE to the selector
>                      if (key==null) key = socket.getIOChannel().register(selector, SelectionKey.OP_WRITE);
>                      else key.interestOps(SelectionKey.OP_WRITE);
> -                    keycount = selector.select(writeTimeout);
> +                    if (writeTimeout<=0) {
> +                        keycount = selector.selectNow();
> +                    } else {
> +                        keycount = selector.select(writeTimeout);
> +                    }
>                  }
>                  if (writeTimeout > 0 && (selector == null || keycount ==
0) ) timedout = (System.currentTimeMillis()-time)>=writeTimeout;
>              }//while
> @@ -264,7 +268,11 @@ public class NioSelectorPool {
>                      //register OP_WRITE to the selector
>                      if (key==null) key = socket.getIOChannel().register(selector, SelectionKey.OP_READ);
>                      else key.interestOps(SelectionKey.OP_READ);
> -                    keycount = selector.select(readTimeout);
> +                    if (readTimeout<=0) {
> +                        keycount = selector.selectNow();
> +                    } else {
> +                        keycount = selector.select(readTimeout);
> +                    }
>                  }
>                  if (readTimeout > 0 && (selector == null || keycount == 0)
) timedout = (System.currentTimeMillis()-time)>=readTimeout;
>              }//while
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
> 



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


Mime
View raw message