public void run() {
final long now = System.nanoTime();
if (pendingBroadcasts != null) {
for (BroadcastEntry entry : pendingBroadcasts.values()) {
final Message message = entry.message;
if (message.getType() != Message.Type.INVACK && now - message.getTimestamp() > timeoutNano) {
if (pendingBroadcasts.remove(message.getMessageId()) != null) {
LOG.debug("Timeout on message {}", message);
receive(Message.TIMEOUT((LineMessage) message).setIncoming());
}
}
}
}
for (Deque<Message> pending : pendingReply.values()) {
for (Message message : reverse(pending)) {
if (message.getType() != Message.Type.INVACK && now - message.getTimestamp() > timeoutNano) {
if (pending.removeLastOccurrence(message)) {// we're using this instead of iterators to safeguard against the case that a reply just arrives
LOG.debug("Timeout on message {}", message);
receive(Message.TIMEOUT((LineMessage) message).setIncoming());
}
} else