Author: fhanik Date: Wed Sep 14 14:42:53 2011 New Revision: 1170656 URL: http://svn.apache.org/viewvc?rev=1170656&view=rev Log: https://issues.apache.org/bugzilla/show_bug.cgi?id=51794 Fix race condition potentially causing a delay in select operations
Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1170656&r1=1170655&r2=1170656&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed Sep 14 14:42:53 2011 @@ -1081,13 +1081,11 @@ public class NioEndpoint extends Abstrac } try { if ( !close ) { - if (wakeupCounter.get()>0) { + if (wakeupCounter.getAndSet(-1) > 0) { //if we are here, means we have other stuff to do //do a non blocking select keyCount = selector.selectNow(); - }else { - keyCount = selector.keys().size(); - wakeupCounter.set(-1); + } else { keyCount = selector.select(selectorTimeout); } wakeupCounter.set(0); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org