diff --git a/src/main/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPing.java b/src/main/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPing.java index b261d8496db..2981e9a34c2 100644 --- a/src/main/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPing.java +++ b/src/main/java/org/elasticsearch/discovery/zen/ping/unicast/UnicastZenPing.java @@ -175,14 +175,18 @@ public class UnicastZenPing extends AbstractLifecycleComponent implemen threadPool.schedule(TimeValue.timeValueMillis(timeout.millis() / 2), ThreadPool.Names.GENERIC, new Runnable() { @Override public void run() { - sendPings(timeout, TimeValue.timeValueMillis(timeout.millis() / 2), sendPingsHandler); - ConcurrentMap responses = receivedResponses.remove(sendPingsHandler.id()); - sendPingsHandler.close(); - for (DiscoveryNode node : sendPingsHandler.nodeToDisconnect) { - logger.trace("[{}] disconnecting from {}", sendPingsHandler.id(), node); - transportService.disconnectFromNode(node); + try { + sendPings(timeout, TimeValue.timeValueMillis(timeout.millis() / 2), sendPingsHandler); + ConcurrentMap responses = receivedResponses.remove(sendPingsHandler.id()); + sendPingsHandler.close(); + for (DiscoveryNode node : sendPingsHandler.nodeToDisconnect) { + logger.trace("[{}] disconnecting from {}", sendPingsHandler.id(), node); + transportService.disconnectFromNode(node); + } + listener.onPing(responses.values().toArray(new PingResponse[responses.size()])); + } catch (RejectedExecutionException ex) { + logger.info("Ping execution ejected", ex); } - listener.onPing(responses.values().toArray(new PingResponse[responses.size()])); } }); }