@Override protected CompletableFuture<Void> stopClusterServices(boolean cleanupHaData) { final CompletableFuture<Void> serviceShutDownFuture = super.stopClusterServices(cleanupHaData); return FutureUtils.runAfterwards( serviceShutDownFuture, () -> { if (mesosServices != null) { mesosServices.close(cleanupHaData); } }); }
@Override protected CompletableFuture<Void> shutDownInternal() { executionGraphCache.close(); final CompletableFuture<Void> shutdownFuture = FutureUtils.runAfterwards( super.shutDownInternal(), () -> ExecutorUtils.gracefulShutdown(10, TimeUnit.SECONDS, executor)); final File webUiDir = restConfiguration.getWebUiDir(); return FutureUtils.runAfterwardsAsync( shutdownFuture, () -> { Exception exception = null; try { log.info("Removing cache directory {}", webUiDir); FileUtils.deleteDirectory(webUiDir); } catch (Exception e) { exception = e; } try { leaderElectionService.stop(); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } if (exception != null) { throw exception; } }); }
@Override protected CompletableFuture<Void> stopClusterServices(boolean cleanupHaData) { final CompletableFuture<Void> serviceShutDownFuture = super.stopClusterServices(cleanupHaData); return FutureUtils.runAfterwards( serviceShutDownFuture, () -> { if (mesosServices != null) { mesosServices.close(cleanupHaData); } }); }
@Override protected CompletableFuture<Void> shutDownInternal() { executionGraphCache.close(); final CompletableFuture<Void> shutdownFuture = FutureUtils.runAfterwards( super.shutDownInternal(), () -> ExecutorUtils.gracefulShutdown(10, TimeUnit.SECONDS, executor)); final File webUiDir = restConfiguration.getWebUiDir(); return FutureUtils.runAfterwardsAsync( shutdownFuture, () -> { Exception exception = null; try { log.info("Removing cache directory {}", webUiDir); FileUtils.deleteDirectory(webUiDir); } catch (Exception e) { exception = e; } try { leaderElectionService.stop(); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } if (exception != null) { throw exception; } }); }
private CompletableFuture<ApplicationStatus> shutDownAsync( ApplicationStatus applicationStatus, @Nullable String diagnostics, boolean cleanupHaData) { if (isShutDown.compareAndSet(false, true)) { LOG.info("Shutting {} down with application status {}. Diagnostics {}.", getClass().getSimpleName(), applicationStatus, diagnostics); final CompletableFuture<Void> shutDownApplicationFuture = closeClusterComponent(applicationStatus, diagnostics); final CompletableFuture<Void> serviceShutdownFuture = FutureUtils.composeAfterwards( shutDownApplicationFuture, () -> stopClusterServices(cleanupHaData)); final CompletableFuture<Void> cleanupDirectoriesFuture = FutureUtils.runAfterwards( serviceShutdownFuture, this::cleanupDirectories); cleanupDirectoriesFuture.whenComplete( (Void ignored2, Throwable serviceThrowable) -> { if (serviceThrowable != null) { terminationFuture.completeExceptionally(serviceThrowable); } else { terminationFuture.complete(applicationStatus); } }); } return terminationFuture; }
private CompletableFuture<ApplicationStatus> shutDownAsync( ApplicationStatus applicationStatus, @Nullable String diagnostics, boolean cleanupHaData) { if (isShutDown.compareAndSet(false, true)) { LOG.info("Shutting {} down with application status {}. Diagnostics {}.", getClass().getSimpleName(), applicationStatus, diagnostics); final CompletableFuture<Void> shutDownApplicationFuture = closeClusterComponent(applicationStatus, diagnostics); final CompletableFuture<Void> serviceShutdownFuture = FutureUtils.composeAfterwards( shutDownApplicationFuture, () -> stopClusterServices(cleanupHaData)); final CompletableFuture<Void> cleanupDirectoriesFuture = FutureUtils.runAfterwards( serviceShutdownFuture, this::cleanupDirectories); cleanupDirectoriesFuture.whenComplete( (Void ignored2, Throwable serviceThrowable) -> { if (serviceThrowable != null) { terminationFuture.completeExceptionally(serviceThrowable); } else { terminationFuture.complete(applicationStatus); } }); } return terminationFuture; }
private CompletableFuture<Void> shutDownAsync( boolean cleanupHaData, ApplicationStatus applicationStatus, @Nullable String diagnostics) { if (isShutDown.compareAndSet(false, true)) { LOG.info("Stopping {}.", getClass().getSimpleName()); final CompletableFuture<Void> shutDownApplicationFuture = deregisterApplication(applicationStatus, diagnostics); final CompletableFuture<Void> componentShutdownFuture = FutureUtils.composeAfterwards( shutDownApplicationFuture, this::stopClusterComponents); final CompletableFuture<Void> serviceShutdownFuture = FutureUtils.composeAfterwards( componentShutdownFuture, () -> stopClusterServices(cleanupHaData)); final CompletableFuture<Void> cleanupDirectoriesFuture = FutureUtils.runAfterwards( serviceShutdownFuture, this::cleanupDirectories); cleanupDirectoriesFuture.whenComplete( (Void ignored2, Throwable serviceThrowable) -> { if (serviceThrowable != null) { terminationFuture.completeExceptionally(serviceThrowable); } else { terminationFuture.complete(null); } }); } return terminationFuture; }
final CompletableFuture<Void> metricGroupTerminationFuture = FutureUtils.runAfterwards( componentTerminationFuture, jobManagerMetricGroup::close);
.thenCompose((Void ignored) -> terminateRpcServices()); final CompletableFuture<Void> remainingServicesTerminationFuture = FutureUtils.runAfterwards( rpcServicesTerminationFuture, this::terminateMiniClusterServices);
.thenCompose((Void ignored) -> terminateRpcServices()); final CompletableFuture<Void> remainingServicesTerminationFuture = FutureUtils.runAfterwards( rpcServicesTerminationFuture, this::terminateMiniClusterServices);
final CompletableFuture<Void> metricGroupTerminationFuture = FutureUtils.runAfterwards( componentTerminationFuture, jobManagerMetricGroup::close);
final CompletableFuture<Void> metricRegistryTerminationFuture = FutureUtils.runAfterwards( componentsTerminationFuture, () -> { .thenCompose((Void ignored) -> terminateRpcServices()); final CompletableFuture<Void> remainingServicesTerminationFuture = FutureUtils.runAfterwards( rpcServicesTerminationFuture, this::terminateMiniClusterServices);
return FutureUtils.runAfterwards( dispatcherTerminationFuture, () -> {
return FutureUtils.runAfterwards( dispatcherTerminationFuture, () -> {
return FutureUtils.runAfterwards( dispatcherTerminationFuture, () -> {
return FutureUtils.runAfterwards( componentTerminationFuture, () -> {
orphanedJobManagerRunnersTerminationFuture)); return FutureUtils.runAfterwards( allJobManagerRunnersTerminationFuture, () -> {
return FutureUtils.runAfterwards( allJobManagerRunnersTerminationFuture, () -> {
return FutureUtils.runAfterwards( allJobManagerRunnersTerminationFuture, () -> {