[#1614] Fix bug in SingleThreadEventExecutor which prevent scheduled tasks to get executed
The problem was that with OioSocketChannel there was always a read Task in the taskQueue and with the old logic it never tried to execute scheduled tasks if there was at least one task in the taskQueue.
This commit is contained in:
parent
eb3283c59c
commit
a4d0341ea1
@ -213,18 +213,19 @@ public abstract class SingleThreadEventExecutor extends AbstractEventExecutor {
|
||||
return task;
|
||||
} else {
|
||||
long delayNanos = delayedTask.delayNanos();
|
||||
Runnable task;
|
||||
Runnable task = null;
|
||||
if (delayNanos > 0) {
|
||||
try {
|
||||
task = taskQueue.poll(delayNanos, TimeUnit.NANOSECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
task = taskQueue.poll();
|
||||
}
|
||||
|
||||
if (task == null) {
|
||||
// We need to fetch the delayed tasks now as otherwise there may be a chance that
|
||||
// delayed tasks are never executed if there is always one task in the taskQueue.
|
||||
// This is for example true for the read task of OIO Transport
|
||||
// See https://github.com/netty/netty/issues/1614
|
||||
fetchFromDelayedQueue();
|
||||
task = taskQueue.poll();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user