in hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskManager.java [180:231]
public void shutdown(long timeout) {
assert this.schedulers.isEmpty() : this.schedulers.size();
Throwable ex = null;
boolean terminated = this.schedulerExecutor.isTerminated();
final TimeUnit unit = TimeUnit.SECONDS;
if (!this.schedulerExecutor.isShutdown()) {
this.schedulerExecutor.shutdown();
try {
terminated = this.schedulerExecutor.awaitTermination(timeout,
unit);
} catch (Throwable e) {
ex = e;
}
}
if (terminated && !this.taskExecutor.isShutdown()) {
this.taskExecutor.shutdown();
try {
terminated = this.taskExecutor.awaitTermination(timeout, unit);
} catch (Throwable e) {
ex = e;
}
}
if (terminated && !this.serverInfoDbExecutor.isShutdown()) {
this.serverInfoDbExecutor.shutdown();
try {
terminated = this.serverInfoDbExecutor.awaitTermination(timeout,
unit);
} catch (Throwable e) {
ex = e;
}
}
if (terminated && !this.taskDbExecutor.isShutdown()) {
this.taskDbExecutor.shutdown();
try {
terminated = this.taskDbExecutor.awaitTermination(timeout, unit);
} catch (Throwable e) {
ex = e;
}
}
if (!terminated) {
ex = new TimeoutException(timeout + "s");
}
if (ex != null) {
throw new HugeException("Failed to wait for TaskScheduler", ex);
}
}