check for release after processig io tasks

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@920330 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2010-03-08 14:19:40 +00:00
parent 192ea889ee
commit 3634d64747
1 changed files with 7 additions and 2 deletions

View File

@ -68,15 +68,18 @@ public class SelectorWorker implements Runnable {
selector.wakeup();
}
private void processIoTasks() {
private boolean processIoTasks() {
boolean rc = false;
Runnable task;
while( (task= ioTasks.poll()) !=null ) {
try {
rc = true;
task.run();
} catch (Throwable e) {
e.printStackTrace();
}
}
return rc;
}
@ -88,7 +91,9 @@ public class SelectorWorker implements Runnable {
Thread.currentThread().setName("Selector Worker: " + id);
while (!isReleased()) {
processIoTasks();
if( processIoTasks() ) {
continue;
}
int count = selector.select(10);
if (count == 0) {
continue;