This commit is contained in:
@@ -372,7 +372,7 @@ public class TcpNioAsyncConnection extends AsyncConnection {
|
||||
|
||||
public void doRead() {
|
||||
try {
|
||||
final boolean invokeDirect = this.ioThread.inSameThread();
|
||||
final boolean invokeDirect = this.ioThread.inCurrThread();
|
||||
int totalCount = 0;
|
||||
boolean hasRemain = true;
|
||||
if (invokeDirect && this.readByteBuffer == null) {
|
||||
@@ -439,7 +439,7 @@ public class TcpNioAsyncConnection extends AsyncConnection {
|
||||
|
||||
public void doWrite() {
|
||||
try {
|
||||
final boolean invokeDirect = this.ioThread.inSameThread();
|
||||
final boolean invokeDirect = this.ioThread.inCurrThread();
|
||||
int totalCount = 0;
|
||||
boolean hasRemain = true;
|
||||
while (invokeDirect && hasRemain) {
|
||||
|
||||
@@ -84,7 +84,7 @@ public class NioThread extends Thread {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean inSameThread() {
|
||||
public boolean inCurrThread() {
|
||||
return this.localThread == Thread.currentThread();
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public class NioThreadGroup {
|
||||
if (key.selector() != thread.selector) throw new RuntimeException("NioThread.selector not the same to SelectionKey.selector");
|
||||
if ((key.interestOps() & opt) != 0) return;
|
||||
key.interestOps(key.interestOps() | opt);
|
||||
if (thread.inSameThread()) return;
|
||||
if (thread.inCurrThread()) return;
|
||||
//非IO线程中
|
||||
key.selector().wakeup();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user