Skip to content

Commit

Permalink
disconnect from unicast nodes before raising event
Browse files Browse the repository at this point in the history
  • Loading branch information
kimchy committed Sep 22, 2012
1 parent aa435a2 commit d5e11fd
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ public void run() {
public void run() {
sendPings(timeout, TimeValue.timeValueMillis(timeout.millis() / 2), sendPingsHandler);
ConcurrentMap<DiscoveryNode, PingResponse> responses = receivedResponses.remove(sendPingsHandler.id());
listener.onPing(responses.values().toArray(new PingResponse[responses.size()]));
sendPingsHandler.close();
for (DiscoveryNode node : sendPingsHandler.nodeToDisconnect) {
logger.trace("[{}] disconnecting from {}", sendPingsHandler.id(), node);
transportService.disconnectFromNode(node);
}
sendPingsHandler.close();
listener.onPing(responses.values().toArray(new PingResponse[responses.size()]));
}
});
}
Expand Down Expand Up @@ -226,7 +226,6 @@ public void close() {
executor.shutdownNow();
executor = null;
}
nodeToDisconnect.clear();
}
}

Expand Down Expand Up @@ -266,6 +265,9 @@ void sendPings(final TimeValue timeout, @Nullable TimeValue waitTime, final Send
@Override
public void run() {
try {
if (sendPingsHandler.isClosed()) {
return;
}
// connect to the node, see if we manage to do it, if not, bail
if (!nodeFoundByAddress) {
logger.trace("[{}] connecting (light) to {}", sendPingsHandler.id(), nodeToSend);
Expand Down

0 comments on commit d5e11fd

Please sign in to comment.