Beispiel #1
0
 @Override
 public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
   final NioSocketChannel ch = (NioSocketChannel) e.getChannel();
   final NetSocket sock = socketMap.get(ch);
   ch.close();
   final Throwable t = e.getCause();
   if (sock != null && t instanceof Exception) {
     VertxInternal.instance.executeOnContext(
         sock.getContextID(),
         new Runnable() {
           public void run() {
             sock.handleException((Exception) t);
           }
         });
   } else {
     t.printStackTrace();
   }
 }
Beispiel #2
0
    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
      final NioSocketChannel ch = (NioSocketChannel) e.getChannel();
      final NetSocket sock = socketMap.remove(ch);
      ch.close();
      final Throwable t = e.getCause();

      log.error("Exception on netserver", t);

      if (sock != null && t instanceof Exception) {
        sock.getContext()
            .execute(
                new Runnable() {
                  public void run() {
                    sock.handleException((Exception) t);
                  }
                });
      } else {
        // Ignore - any exceptions not associated with any sock (e.g. failure in ssl handshake) will
        // be communicated explicitly
      }
    }