Exemplo n.º 1
0
 public void exceptionCaught(ChannelHandlerContext ctx, Throwable t) {
   if (t instanceof ClosedChannelException) {
     _logger.info("Connection {} unexpectedly closed.", ctx.channel());
   } else if (t instanceof Exception) {
     for (NettyTransferService<HttpProtocolInfo>.NettyMoverChannel file : _files) {
       CacheException cause;
       if (file == _writeChannel) {
         cause = new FileCorruptedCacheException("Connection lost before end of file: " + t, t);
       } else {
         cause = new CacheException(t.toString(), t);
       }
       file.release(cause);
     }
     _files.clear();
     ctx.close();
   } else {
     Thread me = Thread.currentThread();
     me.getUncaughtExceptionHandler().uncaughtException(me, t);
     ctx.close();
   }
 }
Exemplo n.º 2
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);
 }
Exemplo n.º 3
0
 @Override
 public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
   cause.printStackTrace();
 }