The events.size() call is costly, because it is a loop that counts entries in a linked queue.
Actually it is not needed here at all, because we iterate the queue by ourselves.
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@
1173614 13f79535-47bb-0310-9956-
ffa450edef68
else r.reset(socket,null,interestOps);
addEvent(r);
}
-
+
+ /**
+ * Processes events in the event queue of the Poller.
+ *
+ * @return <code>true</code> if some events were processed,
+ * <code>false</code> if queue was empty
+ */
public boolean events() {
boolean result = false;
Runnable r = null;
- result = (events.size() > 0);
while ( (r = events.poll()) != null ) {
+ result = true;
try {
r.run();
if ( r instanceof PollerEvent ) {