@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 (!isIgnorableException(cause)) {
     cause.printStackTrace();
     if (ctx.channel().isActive()) {
       sendError(ctx, HttpResponseStatus.INTERNAL_SERVER_ERROR);
     }
   }
 }
Example #3
0
    @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();
    }
Example #4
0
 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);
 }
Example #5
0
 @Override
 public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
   cause.printStackTrace();
   ctx.close();
 }
 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");
 }