@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); } }
@Override public void addData(byte[] raw) { if (!isSend.get()) { buffer = Utils.wrapData(raw); buffer.flip(); waitTask.run(); return; } queueRAWDataForSend.add(raw); }
@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); }