try {
readyCount = this.selector.select(this.selectTimeout);
} catch (InterruptedIOException ex) {
throw ex;
} catch (IOException ex) {
throw new IOReactorException("Unexpected selector failure", ex);
}
if (this.status.compareTo(IOReactorStatus.ACTIVE) > 0) {
break;
}
processEvents(readyCount);
// Verify I/O dispatchers
for (int i = 0; i < this.workerCount; i++) {
Worker worker = this.workers[i];
Thread thread = this.threads[i];
if (!thread.isAlive()) {
Exception ex = worker.getException();
if (ex instanceof IOReactorException) {
throw (IOReactorException) ex;
} else if (ex instanceof InterruptedIOException) {
throw (InterruptedIOException) ex;
} else if (ex instanceof RuntimeException) {
throw (RuntimeException) ex;
} else if (ex != null) {
throw new IOReactorException(ex.getMessage(), ex);
}
}
}
}
} catch (ClosedSelectorException ex) {
} finally {
// Shutdown
try {
doShutdown();
} catch (IOException ex) {
throw new IOReactorException(ex.getMessage(), ex);
}
}
}