diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketChannel.java index 07a527d390..8c3f7ea298 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketChannel.java @@ -47,6 +47,8 @@ import org.jboss.netty.channel.socket.ClientSocketChannelFactory; import org.jboss.netty.channel.socket.SocketChannel; import org.jboss.netty.channel.socket.SocketChannelConfig; import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder; +import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; import org.jboss.netty.util.internal.LinkedTransferQueue; /** @@ -57,6 +59,9 @@ import org.jboss.netty.util.internal.LinkedTransferQueue; class HttpTunnelingClientSocketChannel extends AbstractChannel implements org.jboss.netty.channel.socket.SocketChannel { + static final InternalLogger logger = + InternalLoggerFactory.getInstance(HttpTunnelingClientSocketChannel.class); + private final Lock reconnectLock = new ReentrantLock(); volatile boolean awaitingInitialResponse = true; @@ -257,6 +262,7 @@ class HttpTunnelingClientSocketChannel extends AbstractChannel @Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { + logger.warn("Unexpected exception", e.getCause()); channel.close(); } } diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingServlet.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingServlet.java index d50d2091bd..7907d0f035 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingServlet.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingServlet.java @@ -36,6 +36,8 @@ import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.MessageEvent; +import org.jboss.netty.logging.InternalLogger; +import org.jboss.netty.logging.InternalLoggerFactory; /** * A Servlet that acts as a proxy for a netty channel @@ -48,12 +50,15 @@ public class HttpTunnelingServlet extends HttpServlet { private static final long serialVersionUID = -872309493835745385L; + private static final InternalLogger logger = + InternalLoggerFactory.getInstance(HttpTunnelingServlet.class); + final static String CHANNEL_PROP = "channel"; final static String HANDLER_PROP = "handler"; protected void doRequest( HttpServletRequest request, - HttpServletResponse response) throws IOException { + HttpServletResponse response) { HttpSession session = request.getSession(); Channel channel = (Channel) session.getAttribute(CHANNEL_PROP); HttpTunnelingChannelHandler handler = @@ -64,6 +69,8 @@ public class HttpTunnelingServlet extends HttpServlet { } else { pollResponse(channel, request, response, session, handler); } + } catch (Throwable t) { + logger.warn("Unexpected exception", t); } finally { try { request.getInputStream().close();