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:
parent
e207af30a3
commit
875d5ce513
@ -287,10 +287,14 @@ abstract class AbstractNioWorker implements Worker {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeInIoThread(Runnable task) {
|
public void executeInIoThread(Runnable task) {
|
||||||
start();
|
executeInIoThread(task, false);
|
||||||
if (Thread.currentThread() == thread) {
|
}
|
||||||
|
|
||||||
|
public void executeInIoThread(Runnable task, boolean alwaysAsync) {
|
||||||
|
if (!alwaysAsync && Thread.currentThread() == thread) {
|
||||||
task.run();
|
task.run();
|
||||||
} else {
|
} else {
|
||||||
|
start();
|
||||||
boolean added = eventQueue.offer(task);
|
boolean added = eventQueue.offer(task);
|
||||||
|
|
||||||
assert added;
|
assert added;
|
||||||
|
Loading…
Reference in New Issue
Block a user