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