Пример #1
0
 @Override
 public void failed(Throwable exc, ChannelState attachment) {
   if (exc instanceof InterruptedByTimeoutException) {
     isSend.set(false);
     attachment.isWait().set(false);
     waitTask.run();
   } else {
     LOG.error("Read handler error", exc);
   }
 }
Пример #2
0
  @Override
  public void addData(byte[] raw) {
    if (!isSend.get()) {
      buffer = Utils.wrapData(raw);
      buffer.flip();
      waitTask.run();

      return;
    }

    queueRAWDataForSend.add(raw);
  }
Пример #3
0
  @Override
  public void completed(Integer result, ChannelState attachment) {
    attachment.isWait().set(false);
    buffer = null;

    while (!queueRAWDataForSend.isEmpty()) {
      isSend.set(true);
      buffer = Utils.wrapData(queueRAWDataForSend.poll());
      buffer.flip();

      waitTask.run();
    }

    isSend.set(false);
  }