Пример #1
0
  @Override
  public void channelInactive(ChannelHandlerContext ctx) throws Exception {
    super.channelInactive(ctx);
    this.ctx = null;

    setState(RTSP.ERROR);
  }
Пример #2
0
    @Override
    public void channelInactive(ChannelHandlerContext ctx) throws Exception {
      State currentState = state.get();

      if (currentState instanceof Disconnecting) {
        Idle nextState = new Idle();

        state.compareAndSet(currentState, nextState);
        ((Disconnecting) currentState).disconnectFuture.complete(Unit.VALUE);
      } else {
        Reconnecting nextState = new Reconnecting();

        if (state.compareAndSet(currentState, nextState)) {
          if (currentState instanceof Connected
              && !client.getConfig().isSecureChannelReauthenticationEnabled()) {

            ((Connected) currentState).connected.thenAccept(sc -> sc.setChannelId(0));
          }

          reconnect(nextState, 0);
        }
      }

      super.channelInactive(ctx);
    }
 @Override
 public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
   if (cause instanceof ReadTimeoutException) {
     // channel is already closed here by ReadTimeoutHandler
   } else {
     super.exceptionCaught(ctx, cause);
   }
 }
  @Override
  public void channelActive(final ChannelHandlerContext ctx) throws Exception {
    if (this.ctx == null) {
      this.ctx = ctx;
    }

    super.channelActive(ctx);
  }
Пример #5
0
  @Override
  public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
    super.userEventTriggered(ctx, evt);

    if (evt instanceof IdleStateEvent) {
      sendGetParameters();
    }
  }
 @Override
 public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
   if (evt instanceof IdleStateEvent) {
     ctx.writeAndFlush(HEARTBEAT_SEQUENCE.duplicate())
         .addListener(ChannelFutureListener.CLOSE_ON_FAILURE);
   } else {
     super.userEventTriggered(ctx, evt);
   }
 }
Пример #7
0
    @Override
    public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
      if (getState() != TajoProtos.FetcherState.FETCH_FINISHED) {
        // channel is closed, but cannot complete fetcher
        finishTime = System.currentTimeMillis();
        state = TajoProtos.FetcherState.FETCH_FAILED;
      }
      IOUtils.cleanup(LOG, fc, raf);

      super.channelUnregistered(ctx);
    }
Пример #8
0
  @Override
  public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {

    if (msg instanceof DefaultFullHttpResponse) {
      messageReceive(ctx, (DefaultFullHttpResponse) msg);
    } else if (msg instanceof RtspFrame) {
      RtspFrame rtp = (RtspFrame) msg;
      if (rtp.getChannel() % 2 == 0) { // rtp
        rtspStack.dispatch(new RtspPacketEvent(rtp.getPkt()));
      }
      logger.trace("ignore msg: {}", msg);
      ;
    }

    /** send next */
    super.channelRead(ctx, msg);
  }
  @Override
  public void channelInactive(ChannelHandlerContext ctx) throws Exception {
    // Unexpected close. In normal operation, the client closes the connection after all input
    // channels have been removed. This indicates a problem with the remote task manager.
    if (!inputChannels.isEmpty()) {
      final SocketAddress remoteAddr = ctx.channel().remoteAddress();

      notifyAllChannelsOfErrorAndClose(
          new RemoteTransportException(
              "Connection unexpectedly closed by remote task manager '"
                  + remoteAddr
                  + "'. "
                  + "This might indicate that the remote task manager was lost.",
              remoteAddr));
    }

    super.channelInactive(ctx);
  }
Пример #10
0
 @Override
 public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
   if (evt instanceof IdleStateEvent) {
     IdleStateEvent event = (IdleStateEvent) evt;
     if (event.state().equals(IdleState.READER_IDLE)) {
       System.out.println("READER_IDLE");
       NettyChannelMap.remove(ctx.channel());
       ctx.writeAndFlush(HEARTBEAT_SEQUENCE.duplicate()).addListener(ChannelFutureListener.CLOSE);
     } else if (event.state().equals(IdleState.WRITER_IDLE)) {
       System.out.println("WRITER_IDLE");
     } else if (event.state().equals(IdleState.ALL_IDLE)) {
       System.out.println("ALL_IDLE");
       NettyChannelMap.remove(ctx.channel());
       ctx.writeAndFlush(HEARTBEAT_SEQUENCE.duplicate()).addListener(ChannelFutureListener.CLOSE);
     }
   } else {
     super.userEventTriggered(ctx, evt);
   }
 }
Пример #11
0
 @Override
 public void channelActive(ChannelHandlerContext ctx) throws Exception {
   super.channelActive(ctx);
   this.ctx = ctx;
 }
Пример #12
0
 @Override
 public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
   cause.printStackTrace();
   super.exceptionCaught(ctx, cause);
 }
 @Override
 public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
   super.channelReadComplete(ctx);
 }
 @Override
 public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
   super.handlerRemoved(ctx);
   cancelTask();
 }
 @Override
 public void channelInactive(ChannelHandlerContext ctx) throws Exception {
   super.channelInactive(ctx);
   cancelTask();
 }
 @Override
 public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
   super.exceptionCaught(ctx, cause);
 }
Пример #17
0
 @Override
 public void channelActive(ChannelHandlerContext ctx) throws Exception {
   allChannels.add(ctx.channel());
   super.channelActive(ctx);
 }
  @Override
  public void channelInactive(@NotNull ChannelHandlerContext context) throws Exception {
    clientChannels.remove(context.channel());

    super.channelInactive(context);
  }