in minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterControl.java [270:390]
public synchronized void stop(ServerType server, String hostname) throws IOException {
switch (server) {
case MANAGER:
if (managerProcess != null) {
try {
cluster.stopProcessWithTimeout(managerProcess, 30, TimeUnit.SECONDS);
try {
new ZooZap().zap(cluster.getServerContext(), "-manager");
} catch (RuntimeException e) {
log.error("Error zapping Manager zookeeper lock", e);
}
} catch (ExecutionException | TimeoutException e) {
log.warn("Manager did not fully stop after 30 seconds", e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
managerProcess = null;
}
}
break;
case GARBAGE_COLLECTOR:
if (gcProcess != null) {
try {
cluster.stopProcessWithTimeout(gcProcess, 30, TimeUnit.SECONDS);
} catch (ExecutionException | TimeoutException e) {
log.warn("Garbage collector did not fully stop after 30 seconds", e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
gcProcess = null;
}
}
break;
case ZOOKEEPER:
if (zooKeeperProcess != null) {
try {
cluster.stopProcessWithTimeout(zooKeeperProcess, 30, TimeUnit.SECONDS);
} catch (ExecutionException | TimeoutException e) {
log.warn("ZooKeeper did not fully stop after 30 seconds", e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
zooKeeperProcess = null;
}
}
break;
case TABLET_SERVER:
synchronized (tabletServerProcesses) {
try {
tabletServerProcesses.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);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
});
});
} finally {
tabletServerProcesses.clear();
}
}
break;
case MONITOR:
if (monitor != null) {
try {
cluster.stopProcessWithTimeout(monitor, 30, TimeUnit.SECONDS);
} catch (ExecutionException | TimeoutException e) {
log.warn("Monitor did not fully stop after 30 seconds", e);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} finally {
monitor = null;
}
}
break;
case SCAN_SERVER:
synchronized (scanServerProcesses) {
try {
scanServerProcesses.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);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
});
});
} finally {
scanServerProcesses.clear();
}
}
break;
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);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
});
});
} finally {
compactorProcesses.clear();
}
}
break;
default:
throw new UnsupportedOperationException("ServerType is not yet supported " + server);
}
}