No need to check instanceof everytime to find the next inbound / outbound context
This commit is contained in:
parent
aedd631dbb
commit
b8866aef33
@ -30,6 +30,8 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
|
|||||||
volatile DefaultChannelHandlerContext next;
|
volatile DefaultChannelHandlerContext next;
|
||||||
volatile DefaultChannelHandlerContext prev;
|
volatile DefaultChannelHandlerContext prev;
|
||||||
|
|
||||||
|
private final boolean inbound;
|
||||||
|
private final boolean outbound;
|
||||||
private final AbstractChannel channel;
|
private final AbstractChannel channel;
|
||||||
private final DefaultChannelPipeline pipeline;
|
private final DefaultChannelPipeline pipeline;
|
||||||
private final String name;
|
private final String name;
|
||||||
@ -74,6 +76,9 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
|
|||||||
} else {
|
} else {
|
||||||
executor = null;
|
executor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inbound = handler instanceof ChannelInboundHandler;
|
||||||
|
outbound = handler instanceof ChannelOutboundHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Invocation initiated by {@link DefaultChannelPipeline#teardownAll()}}. */
|
/** Invocation initiated by {@link DefaultChannelPipeline#teardownAll()}}. */
|
||||||
@ -816,7 +821,7 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
|
|||||||
DefaultChannelHandlerContext ctx = this;
|
DefaultChannelHandlerContext ctx = this;
|
||||||
do {
|
do {
|
||||||
ctx = ctx.next;
|
ctx = ctx.next;
|
||||||
} while (!(ctx.handler instanceof ChannelInboundHandler));
|
} while (!ctx.inbound);
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -824,7 +829,7 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
|
|||||||
DefaultChannelHandlerContext ctx = this;
|
DefaultChannelHandlerContext ctx = this;
|
||||||
do {
|
do {
|
||||||
ctx = ctx.prev;
|
ctx = ctx.prev;
|
||||||
} while (!(ctx.handler instanceof ChannelOutboundHandler));
|
} while (!ctx.outbound);
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user