Touch a ReferenceCounted while it traverses across a pipeline

This commit is contained in:
Trustin Lee 2014-02-13 18:11:54 -08:00
parent 45e70d9935
commit 0235244e55

View File

@ -329,6 +329,7 @@ final class DefaultChannelHandlerContext implements ChannelHandlerContext {
throw new NullPointerException("msg"); throw new NullPointerException("msg");
} }
ReferenceCountUtil.touch(msg);
final DefaultChannelHandlerContext next = findContextInbound(); final DefaultChannelHandlerContext next = findContextInbound();
EventExecutor executor = next.executor(); EventExecutor executor = next.executor();
if (executor.inEventLoop()) { if (executor.inEventLoop()) {
@ -705,6 +706,7 @@ final class DefaultChannelHandlerContext implements ChannelHandlerContext {
private void write(Object msg, boolean flush, ChannelPromise promise) { private void write(Object msg, boolean flush, ChannelPromise promise) {
ReferenceCountUtil.touch(msg);
DefaultChannelHandlerContext next = findContextOutbound(); DefaultChannelHandlerContext next = findContextOutbound();
EventExecutor executor = next.executor(); EventExecutor executor = next.executor();
if (executor.inEventLoop()) { if (executor.inEventLoop()) {