A workaround for 100% CPU consumption issue in NIO selectors, suggested by David M. Lloyd
This commit is contained in:
parent
dabea9dfff
commit
52221931d5
@ -339,7 +339,7 @@ class NioDatagramWorker implements Runnable {
|
||||
i.remove();
|
||||
try {
|
||||
int readyOps = k.readyOps();
|
||||
if ((readyOps & SelectionKey.OP_READ) != 0) {
|
||||
if ((readyOps & SelectionKey.OP_READ) != 0 || readyOps == 0) {
|
||||
if (!read(k)) {
|
||||
// Connection already closed - no need to handle write.
|
||||
continue;
|
||||
|
@ -271,7 +271,7 @@ class NioWorker implements Runnable {
|
||||
i.remove();
|
||||
try {
|
||||
int readyOps = k.readyOps();
|
||||
if ((readyOps & SelectionKey.OP_READ) != 0) {
|
||||
if ((readyOps & SelectionKey.OP_READ) != 0 || readyOps == 0) {
|
||||
if (!read(k)) {
|
||||
// Connection already closed - no need to handle write.
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user