mirror of https://github.com/apache/activemq.git
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:
parent
192ea889ee
commit
3634d64747
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue