This commit is contained in:
Redkale
2021-01-19 17:40:08 +08:00
parent b83f6867f3
commit 7d1770da8a
3 changed files with 4 additions and 4 deletions

View File

@@ -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) {

View File

@@ -84,7 +84,7 @@ public class NioThread extends Thread {
}
}
public boolean inSameThread() {
public boolean inCurrThread() {
return this.localThread == Thread.currentThread();
}

View File

@@ -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();
}