You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2018/08/02 06:29:35 UTC
[GitHub] asdf2014 commented on a change in pull request #6090: Fix missing
exception handling as part of
`io.druid.java.util.http.client.netty.HttpClientPipelineFactory`
asdf2014 commented on a change in pull request #6090: Fix missing exception handling as part of `io.druid.java.util.http.client.netty.HttpClientPipelineFactory`
URL: https://github.com/apache/incubator-druid/pull/6090#discussion_r207113241
##########
File path: java-util/src/main/java/io/druid/java/util/http/client/netty/HttpClientHandler.java
##########
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package io.druid.java.util.http.client.netty;
+
+import io.druid.java.util.common.logger.Logger;
+import org.jboss.netty.channel.ChannelHandler;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ExceptionEvent;
+import org.jboss.netty.handler.codec.http.HttpContentDecompressor;
+
+/**
+ */
+@ChannelHandler.Sharable
+public class HttpClientHandler extends HttpContentDecompressor
+{
+ private static final Logger LOGGER = new Logger(HttpClientHandler.class);
+
+ @Override
+ public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
+ {
+ try {
+ final Throwable cause = e.getCause();
+ if (cause != null) {
+ LOGGER.error(cause, "Caught exception from [%s] channel handler", ctx.getName());
+ }
+ }
+ finally {
+ try {
+ ctx.getChannel().close();
+ }
+ finally {
+ ctx.sendUpstream(e);
Review comment:
Removed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org