Remove unneccesary checks

This commit is contained in:
Brian Devins-Suresh 2020-03-20 05:41:35 -04:00
parent 7e45aa731f
commit baf02ff526
1 changed files with 6 additions and 12 deletions

View File

@ -109,33 +109,27 @@ public class NettyChannelPipelineInstrumentation extends Instrumenter.Default {
final ChannelHandler handler) { final ChannelHandler handler) {
try { try {
// Server pipeline handlers // Server pipeline handlers
if (handler instanceof HttpServerCodec if (handler instanceof HttpServerCodec) {
&& pipeline.get(HttpServerTracingHandler.class.getName()) == null) {
pipeline.addLast( pipeline.addLast(
HttpServerTracingHandler.class.getName(), new HttpServerTracingHandler(contextStore)); HttpServerTracingHandler.class.getName(), new HttpServerTracingHandler(contextStore));
} else if (handler instanceof HttpRequestDecoder } else if (handler instanceof HttpRequestDecoder) {
&& pipeline.get(HttpServerRequestTracingHandler.class.getName()) == null) {
pipeline.addLast( pipeline.addLast(
HttpServerRequestTracingHandler.class.getName(), HttpServerRequestTracingHandler.class.getName(),
new HttpServerRequestTracingHandler(contextStore)); new HttpServerRequestTracingHandler(contextStore));
} else if (handler instanceof HttpResponseEncoder } else if (handler instanceof HttpResponseEncoder) {
&& pipeline.get(HttpServerResponseTracingHandler.class.getName()) == null) {
pipeline.addLast( pipeline.addLast(
HttpServerResponseTracingHandler.class.getName(), HttpServerResponseTracingHandler.class.getName(),
new HttpServerResponseTracingHandler(contextStore)); new HttpServerResponseTracingHandler(contextStore));
} else } else
// Client pipeline handlers // Client pipeline handlers
if (handler instanceof HttpClientCodec if (handler instanceof HttpClientCodec) {
&& pipeline.get(HttpClientTracingHandler.class.getName()) == null) {
pipeline.addLast( pipeline.addLast(
HttpClientTracingHandler.class.getName(), new HttpClientTracingHandler(contextStore)); HttpClientTracingHandler.class.getName(), new HttpClientTracingHandler(contextStore));
} else if (handler instanceof HttpRequestEncoder } else if (handler instanceof HttpRequestEncoder) {
&& pipeline.get(HttpClientRequestTracingHandler.class.getName()) == null) {
pipeline.addLast( pipeline.addLast(
HttpClientRequestTracingHandler.class.getName(), HttpClientRequestTracingHandler.class.getName(),
new HttpClientRequestTracingHandler(contextStore)); new HttpClientRequestTracingHandler(contextStore));
} else if (handler instanceof HttpResponseDecoder } else if (handler instanceof HttpResponseDecoder) {
&& pipeline.get(HttpClientResponseTracingHandler.class.getName()) == null) {
pipeline.addLast( pipeline.addLast(
HttpClientResponseTracingHandler.class.getName(), HttpClientResponseTracingHandler.class.getName(),
new HttpClientResponseTracingHandler(contextStore)); new HttpClientResponseTracingHandler(contextStore));