Created
July 23, 2022 00:31
-
-
Save zeroFruit/269780cb73220902d604ddbce0633817 to your computer and use it in GitHub Desktop.
Channel concept & implementation— el Project (2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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