Allow to force the execution of the Runnable in a async fashion even if

the IO-Thread is the current Thread
This commit is contained in:
Norman Maurer 2012-03-07 17:52:49 +01:00
parent e207af30a3
commit 875d5ce513

View File

@ -287,10 +287,14 @@ abstract class AbstractNioWorker implements Worker {
@Override
public void executeInIoThread(Runnable task) {
start();
if (Thread.currentThread() == thread) {
executeInIoThread(task, false);
}
public void executeInIoThread(Runnable task, boolean alwaysAsync) {
if (!alwaysAsync && Thread.currentThread() == thread) {
task.run();
} else {
start();
boolean added = eventQueue.offer(task);
assert added;