@Override public void exceptionCaught(ChannelHandlerContext context, Throwable cause) { LOG.error(cause.getMessage(), cause); if (context.channel().isOpen()) { context.channel().close(); } }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { if (cause instanceof ReadTimeoutException) { LOG.warn(cause.getMessage(), cause); } else { LOG.error("Fetch failed :", cause); } // this fetching will be retry IOUtils.cleanup(LOG, fc, raf); finishTime = System.currentTimeMillis(); state = TajoProtos.FetcherState.FETCH_FAILED; ctx.close(); }
private void handleDeath(Throwable cause) { if (cause != null) sendHttpResponse( ctx, req, new DefaultFullHttpResponse( req.getProtocolVersion(), INTERNAL_SERVER_ERROR, Unpooled.wrappedBuffer( ("Actor is dead because of " + cause.getMessage()).getBytes())), false); else sendHttpResponse( ctx, req, new DefaultFullHttpResponse( req.getProtocolVersion(), INTERNAL_SERVER_ERROR, Unpooled.wrappedBuffer(("Actor has terminated.").getBytes())), false); }
private boolean isIgnorableException(Throwable throwable) { // There really does not seem to be a better way of detecting this kind of exception return throwable instanceof IOException && throwable.getMessage().equals("Connection reset by peer"); }