[#1777] Use correct Thread when close per channel
This commit is contained in:
parent
f76c01c3aa
commit
77d4222db5
@ -198,9 +198,21 @@ public class LocalChannel extends AbstractChannel {
|
|||||||
state = 3;
|
state = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalChannel peer = this.peer;
|
final LocalChannel peer = this.peer;
|
||||||
if (peer != null && peer.isActive()) {
|
if (peer != null && peer.isActive()) {
|
||||||
peer.unsafe().close(unsafe().voidPromise());
|
// Need to execute the close in the correct EventLoop
|
||||||
|
// See https://github.com/netty/netty/issues/1777
|
||||||
|
EventLoop eventLoop = peer.eventLoop();
|
||||||
|
if (eventLoop.inEventLoop()) {
|
||||||
|
peer.unsafe().close(unsafe().voidPromise());
|
||||||
|
} else {
|
||||||
|
peer.eventLoop().execute(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
peer.unsafe().close(unsafe().voidPromise());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
this.peer = null;
|
this.peer = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user