@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);
     }
   }
 }
Beispiel #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();
    }
 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);
 }
 @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");
 }