in fluss-server/src/main/java/com/alibaba/fluss/server/coordinator/CoordinatorServer.java [305:416]
CompletableFuture<Void> stopServices() {
synchronized (lock) {
Throwable exception = null;
try {
if (serverMetricGroup != null) {
serverMetricGroup.close();
}
} catch (Throwable t) {
exception = ExceptionUtils.firstOrSuppressed(t, exception);
}
final Collection<CompletableFuture<Void>> terminationFutures = new ArrayList<>(2);
try {
if (metricRegistry != null) {
terminationFutures.add(metricRegistry.closeAsync());
}
} catch (Throwable t) {
exception = ExceptionUtils.firstOrSuppressed(t, exception);
}
try {
if (autoPartitionManager != null) {
autoPartitionManager.close();
}
} catch (Throwable t) {
exception = ExceptionUtils.firstOrSuppressed(t, exception);
}
try {
if (ioExecutor != null) {
// shutdown io executor
ExecutorUtils.gracefulShutdown(5, TimeUnit.SECONDS, ioExecutor);
}
} catch (Throwable t) {
exception = ExceptionUtils.firstOrSuppressed(t, exception);
}
try {
if (coordinatorEventProcessor != null) {
coordinatorEventProcessor.shutdown();
}
} catch (Throwable t) {
exception = ExceptionUtils.firstOrSuppressed(t, exception);
}
try {
if (coordinatorChannelManager != null) {
coordinatorChannelManager.close();
}
} catch (Throwable t) {
exception = ExceptionUtils.firstOrSuppressed(t, exception);
}
try {
if (rpcServer != null) {
terminationFutures.add(rpcServer.closeAsync());
}
} catch (Throwable t) {
exception = ExceptionUtils.firstOrSuppressed(t, exception);
}
try {
if (coordinatorService != null) {
coordinatorService.shutdown();
}
} catch (Throwable t) {
exception = ExceptionUtils.firstOrSuppressed(t, exception);
}
try {
if (lakeTableTieringManager != null) {
lakeTableTieringManager.close();
}
} catch (Throwable t) {
exception = ExceptionUtils.firstOrSuppressed(t, exception);
}
try {
if (zkClient != null) {
zkClient.close();
}
} catch (Throwable t) {
exception = ExceptionUtils.firstOrSuppressed(t, exception);
}
try {
if (authorizer != null) {
authorizer.close();
}
} catch (Throwable t) {
exception = ExceptionUtils.firstOrSuppressed(t, exception);
}
try {
if (rpcClient != null) {
rpcClient.close();
}
if (clientMetricGroup != null) {
clientMetricGroup.close();
}
} catch (Throwable t) {
exception = ExceptionUtils.firstOrSuppressed(t, exception);
}
if (exception != null) {
terminationFutures.add(FutureUtils.completedExceptionally(exception));
}
return FutureUtils.completeAll(terminationFutures);
}
}