kevinrr888 commented on code in PR #5697:
URL: https://github.com/apache/accumulo/pull/5697#discussion_r2177837172


##########
minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterControl.java:
##########
@@ -382,17 +348,9 @@ public synchronized void stop(ServerType server, String 
hostname) throws IOExcep
       case COMPACTOR:
         synchronized (compactorProcesses) {
           try {
-            compactorProcesses.values().forEach(list -> {
-              list.forEach(process -> {
-                try {
-                  cluster.stopProcessWithTimeout(process, 30, 
TimeUnit.SECONDS);
-                } catch (ExecutionException | TimeoutException e) {
-                  log.warn("TabletServer did not fully stop after 30 seconds", 
e);

Review Comment:
   These warnings said TabletServer regardless of process in several places, so 
nice to see that fixed here as well



##########
minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java:
##########
@@ -1094,6 +1098,35 @@ protected ExecutorService getShutdownExecutor() {
     return executor;
   }
 
+  public void stopProcessesWithTimeout(final ServerType type, final 
List<Process> procs,
+      final long timeout, final TimeUnit unit) {
+
+    final List<Future<Integer>> futures = new ArrayList<>();
+    for (Process proc : procs) {
+      futures.add(executor.submit(() -> {
+        proc.destroy();
+        proc.waitFor(timeout, unit);
+        return proc.exitValue();
+      }));
+    }
+
+    while (!futures.isEmpty()) {
+      Iterator<Future<Integer>> iter = futures.iterator();
+      while (iter.hasNext()) {
+        Future<Integer> f = iter.next();
+        if (f.isDone()) {
+          try {
+            f.get();
+          } catch (ExecutionException | InterruptedException e) {
+            log.warn("{} did not fully stop after 30 seconds", type, e);
+          } finally {

Review Comment:
   Do we want to swallow the InterruptedException here? Or should we restore 
the interrupt status



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to