Fix race condition in selector potentially causing a delay in select operations
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@
1170647 13f79535-47bb-0310-9956-
ffa450edef68
}
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);