예제 #1
0
 @Override
 public void exceptionCaught(ChannelHandlerContext context, Throwable cause) {
   LOG.error(cause.getMessage(), cause);
   if (context.channel().isOpen()) {
     context.channel().close();
   }
 }
예제 #2
0
 @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);
     }
   }
 }
예제 #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();
    }
예제 #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);
 }
예제 #5
0
 @Override
 public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
   cause.printStackTrace();
   ctx.close();
 }
예제 #6
0
 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");
 }