Bug 470727 - Thread Starvation of selector wakeups.
Added comment on running non-blocking code immediately.
This commit is contained in:
parent
4e3b400550
commit
f62305b5a5
|
@ -100,19 +100,22 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements ManagedSel
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("onSelected {}->{} for {}", oldInterestOps, newInterestOps, this);
|
LOG.debug("onSelected {}->{} for {}", oldInterestOps, newInterestOps, this);
|
||||||
|
|
||||||
|
|
||||||
boolean readable = (readyOps & SelectionKey.OP_READ) != 0;
|
boolean readable = (readyOps & SelectionKey.OP_READ) != 0;
|
||||||
boolean writable = (readyOps & SelectionKey.OP_WRITE) != 0;
|
boolean writable = (readyOps & SelectionKey.OP_WRITE) != 0;
|
||||||
|
|
||||||
// Call non blocking directly
|
// Run non-blocking code immediately.
|
||||||
|
// This producer knows that this non-blocking code is special
|
||||||
|
// and that it must be run in this thread and not fed to the
|
||||||
|
// ExecutionStrategy, which could not have any thread to run these
|
||||||
|
// tasks (or it may starve forever just after having run them).
|
||||||
if (readable && getFillInterest().isCallbackNonBlocking())
|
if (readable && getFillInterest().isCallbackNonBlocking())
|
||||||
{
|
{
|
||||||
getFillInterest().fillable();
|
_runFillable.run();
|
||||||
readable = false;
|
readable = false;
|
||||||
}
|
}
|
||||||
if (writable && getWriteFlusher().isCallbackNonBlocking())
|
if (writable && getWriteFlusher().isCallbackNonBlocking())
|
||||||
{
|
{
|
||||||
getWriteFlusher().completeWrite();
|
_runCompleteWrite.run();
|
||||||
writable = false;
|
writable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue