Break fetching metrics when stopped
@@ -161,9 +161,10 @@ public class ApplicationMetricsRetriever extends AbstractComponent implements Ru
int numOk = 0;
int numTried = futures.size();
for (Map.Entry<Node, Future<Boolean>> entry : futures.entrySet()) {
+ if (stopped) break;
try {
Boolean result = entry.getValue().get(taskTimeout.get().toMillis(), TimeUnit.MILLISECONDS);
- if ((result != null) && result) numOk++;
+ if (result == Boolean.TRUE) numOk++;
} catch (InterruptedException | ExecutionException | TimeoutException e) {
Throwable cause = e.getCause();
if (e instanceof ExecutionException && ((cause instanceof SocketException) || cause instanceof ConnectTimeoutException)) {
