2012/3/22 <ma...@apache.org>: > Author: markt > Date: Thu Mar 22 19:47:58 2012 > New Revision: 1304011 > > URL: http://svn.apache.org/viewvc?rev=1304011&view=rev > Log: > Still process events when closing to ensure that Comet connections that are > in use when the poller is stopped are sent an end event. > > Modified: > tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java > > Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java > URL: > http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1304011&r1=1304010&r2=1304011&view=diff > ============================================================================== > --- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) > +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Thu Mar 22 > 19:47:58 2012 > @@ -963,7 +963,6 @@ public class NioEndpoint extends Abstrac > // exit, otherwise parallel closure of sockets which are still > // in the poller can cause problems > close = true; > - events.clear(); > selector.wakeup(); > } > > @@ -998,6 +997,9 @@ public class NioEndpoint extends Abstrac > if ( r==null) r = new PollerEvent(socket,null,interestOps); > else r.reset(socket,null,interestOps); > addEvent(r); > + if (close) { > + processSocket(socket, SocketStatus.STOP, false); > + } > } > > /** > @@ -1113,12 +1115,15 @@ public class NioEndpoint extends Abstrac > } > } > > - boolean hasEvents = events(); > + boolean hasEvents = false; > > // Time to terminate? > if (close) {
(1) > + events(); > timeout(0, false); > break; > + } else { > + hasEvents = events(); > } > try { > if ( !close ) { > @@ -1132,6 +1137,7 @@ public class NioEndpoint extends Abstrac > wakeupCounter.set(0); > } > if (close) { (2) > + events(); > timeout(0, false); > selector.close(); > break; > Comparing (1) and (2), both are terminating the loop, but the (2)nd block has "selector.close()" call and (1)st does not have the call. I suspect that both should have the close() call. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org