Skip to content

Instantly share code, notes, and snippets.

@zeroFruit
Created July 23, 2022 00:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeroFruit/269780cb73220902d604ddbce0633817 to your computer and use it in GitHub Desktop.
Save zeroFruit/269780cb73220902d604ddbce0633817 to your computer and use it in GitHub Desktop.
Channel concept & implementation— el Project (2)
public abstract class AbstractChannelHandlerContext implements ChannelHandlerContext {
static void invokeExceptionCaught(
final AbstractChannelHandlerContext next, final Throwable cause) {
EventLoop eventLoop = next.eventLoop();
if (eventLoop.inEventLoop()) {
next.invokeExceptionCaught(cause);
} else {
eventLoop.execute(() -> next.invokeExceptionCaught(cause));
}
}
@Override
public ChannelHandlerContext fireExceptionCaught(Throwable t) {
invokeExceptionCaught(findContextInbound(), t);
return this;
}
private void invokeExceptionCaught(Throwable t) {
try {
((ChannelInboundHandler) handler()).exceptionCaught(this, t);
} catch (Throwable err) {
...
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment