Ejemplo n.º 1
0
 @Override
 public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) {
   final NioSocketChannel ch = (NioSocketChannel) e.getChannel();
   final NetSocket sock = socketMap.remove(ch);
   if (sock != null) {
     VertxInternal.instance.executeOnContext(
         sock.getContextID(),
         new Runnable() {
           public void run() {
             sock.handleClosed();
           }
         });
   }
 }
Ejemplo n.º 2
0
 @Override
 public void channelInterestChanged(ChannelHandlerContext ctx, ChannelStateEvent e)
     throws Exception {
   final NioSocketChannel ch = (NioSocketChannel) e.getChannel();
   final NetSocket sock = socketMap.get(ch);
   ChannelState state = e.getState();
   if (state == ChannelState.INTEREST_OPS) {
     VertxInternal.instance.executeOnContext(
         sock.getContextID(),
         new Runnable() {
           public void run() {
             sock.handleInterestedOpsChanged();
           }
         });
   }
 }
Ejemplo n.º 3
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();
   }
 }