if (!isDisconnected.getAndSet(true)) {
// notify pending handlers
while (!handlersWaitingForResponseHeader.isEmpty()) {
handlersWaitingForResponseHeader.remove(0).onException(new ClosedChannelException());
}
// notify waiting handler
for (MessageHeaderHandler messageHandler : getHandlersWaitingForResponseCopy()) {
ClosedChannelException cce = newDetailedClosedChannelException("channel " + getId() + " is closed (by peer?) while receiving response data " +
"(countMessagesSent=" + getCountMessagesSent() + ", countMessagesReceived=" + getCountMessagesReceived() +
", countReceivedBytes=" + getCountReceivedBytes() + ")");
messageHandler.onException(cce);
}
handlersWaitingForResponseHeader.clear();