summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2023-07-11 12:02:13 +0200
committerjonmv <venstad@gmail.com>2023-07-13 10:30:49 +0200
commitbb006b94caafd982c633a2830f1eb9a63d24fc0c (patch)
treecbe487079e50fbb5dc6adad6f391072f253da81a /container-search
parent4e19b88dde87c8186bde9ae9def6c0f24a87f784 (diff)
Reinstate public (unused) method, warn when failing ping shutdown
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/search/cluster/ClusterMonitor.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/cluster/ClusterMonitor.java b/container-search/src/main/java/com/yahoo/search/cluster/ClusterMonitor.java
index d66b6637cd3..d1c212168a6 100644
--- a/container-search/src/main/java/com/yahoo/search/cluster/ClusterMonitor.java
+++ b/container-search/src/main/java/com/yahoo/search/cluster/ClusterMonitor.java
@@ -104,6 +104,11 @@ public class ClusterMonitor<T> {
}
/** Returns a thread-safe snapshot of the NodeMonitors of all added nodes */
+ public Iterator<BaseNodeMonitor<T>> nodeMonitorIterator() {
+ return nodeMonitors().iterator();
+ }
+
+ /** Returns a thread-safe snapshot of the NodeMonitors of all added nodes */
public List<BaseNodeMonitor<T>> nodeMonitors() {
return List.copyOf(nodeMonitors.values());
}
@@ -137,7 +142,7 @@ public class ClusterMonitor<T> {
// for all pings when there are no problems (important because it ensures that
// any thread local connections are reused) 2) a new thread will be started to execute
// new pings when a ping is not responding
- ExecutorService pingExecutor=Executors.newCachedThreadPool(ThreadFactoryFactory.getDaemonThreadFactory("search.ping"));
+ ExecutorService pingExecutor = Executors.newCachedThreadPool(ThreadFactoryFactory.getDaemonThreadFactory("search.ping"));
while (!closed.get()) {
try {
log.finest("Activating ping");
@@ -159,7 +164,9 @@ public class ClusterMonitor<T> {
}
pingExecutor.shutdown();
try {
- pingExecutor.awaitTermination(10, TimeUnit.SECONDS);
+ if ( ! pingExecutor.awaitTermination(10, TimeUnit.SECONDS)) {
+ log.warning("Timeout waiting for ping executor to terminate");
+ }
} catch (InterruptedException e) { }
log.info("Stopped cluster monitor thread " + getName());
}