private static Throwable shutDownRpc(RpcService rpcService, Throwable priorException) { if (rpcService != null) { try { rpcService.stopService().get(); } catch (Throwable t) { return ExceptionUtils.firstOrSuppressed(t, priorException); } } return priorException; }
/** * Shuts the given rpc service down and waits for its termination. * * @param rpcService to shut down * @param timeout for this operation * @throws InterruptedException if the operation has been interrupted * @throws ExecutionException if a problem occurred * @throws TimeoutException if a timeout occurred */ public static void terminateRpcService(RpcService rpcService, Time timeout) throws InterruptedException, ExecutionException, TimeoutException { rpcService.stopService().get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS); }
private static Throwable shutDownRpc(RpcService rpcService, Throwable priorException) { if (rpcService != null) { try { rpcService.stopService().get(); } catch (Throwable t) { return ExceptionUtils.firstOrSuppressed(t, priorException); } } return priorException; }
/** * Shuts the given rpc service down and waits for its termination. * * @param rpcService to shut down * @param timeout for this operation * @throws InterruptedException if the operation has been interrupted * @throws ExecutionException if a problem occurred * @throws TimeoutException if a timeout occurred */ public static void terminateRpcService(RpcService rpcService, Time timeout) throws InterruptedException, ExecutionException, TimeoutException { rpcService.stopService().get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS); }
private static Throwable shutDownRpc(RpcService rpcService, Throwable priorException) { if (rpcService != null) { try { rpcService.stopService(); } catch (Throwable t) { return firstOrSuppressed(t, priorException); } } return priorException; }
/** * Shuts the given rpc service down and waits for its termination. * * @param rpcService to shut down * @param timeout for this operation * @throws InterruptedException if the operation has been interrupted * @throws ExecutionException if a problem occurred * @throws TimeoutException if a timeout occurred */ public static void terminateRpcService(RpcService rpcService, Time timeout) throws InterruptedException, ExecutionException, TimeoutException { rpcService.stopService().get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS); }
private static Throwable shutDownRpc(RpcService rpcService, Throwable priorException) { if (rpcService != null) { try { rpcService.stopService().get(); } catch (Throwable t) { return ExceptionUtils.firstOrSuppressed(t, priorException); } } return priorException; }
private static Throwable shutDownRpcs(RpcService[] rpcServices, Throwable priorException) { if (rpcServices != null) { Throwable exception = priorException; for (RpcService service : rpcServices) { try { if (service != null) { service.stopService(); } } catch (Throwable t) { exception = firstOrSuppressed(t, exception); } } } return priorException; }
private static Throwable shutDownRpcs(RpcService[] rpcServices, Throwable priorException) { if (rpcServices != null) { Throwable exception = priorException; for (RpcService service : rpcServices) { try { if (service != null) { service.stopService().get(); } } catch (Throwable t) { exception = ExceptionUtils.firstOrSuppressed(t, exception); } } } return priorException; }
private static Throwable shutDownRpcs(RpcService[] rpcServices, Throwable priorException) { if (rpcServices != null) { Throwable exception = priorException; for (RpcService service : rpcServices) { try { if (service != null) { service.stopService().get(); } } catch (Throwable t) { exception = ExceptionUtils.firstOrSuppressed(t, exception); } } } return priorException; }
private static Throwable shutDownRpcs(RpcService[] rpcServices, Throwable priorException) { if (rpcServices != null) { Throwable exception = priorException; for (RpcService service : rpcServices) { try { if (service != null) { service.stopService().get(); } } catch (Throwable t) { exception = ExceptionUtils.firstOrSuppressed(t, exception); } } } return priorException; }
@Nonnull private CompletionStage<Void> terminateRpcServices() { final int numRpcServices; if (miniClusterConfiguration.getRpcServiceSharing() == RpcServiceSharing.SHARED) { numRpcServices = 1; } else { numRpcServices = 1 + 2 + miniClusterConfiguration.getNumTaskManagers(); // common, JM, RM, TMs } final Collection<CompletableFuture<?>> rpcTerminationFutures = new ArrayList<>(numRpcServices); synchronized (lock) { rpcTerminationFutures.add(commonRpcService.stopService()); if (miniClusterConfiguration.getRpcServiceSharing() != RpcServiceSharing.SHARED) { rpcTerminationFutures.add(jobManagerRpcService.stopService()); rpcTerminationFutures.add(resourceManagerRpcService.stopService()); for (RpcService taskManagerRpcService : taskManagerRpcServices) { rpcTerminationFutures.add(taskManagerRpcService.stopService()); } } commonRpcService = null; jobManagerRpcService = null; taskManagerRpcServices = null; resourceManagerRpcService = null; } return FutureUtils.completeAll(rpcTerminationFutures); }
@Nonnull private CompletionStage<Void> terminateRpcServices() { final int numRpcServices; if (miniClusterConfiguration.getRpcServiceSharing() == MiniClusterConfiguration.RpcServiceSharing.SHARED) { numRpcServices = 1; } else { numRpcServices = 1 + 2 + miniClusterConfiguration.getNumTaskManagers(); // common, JM, RM, TMs } final Collection<CompletableFuture<?>> rpcTerminationFutures = new ArrayList<>(numRpcServices); synchronized (lock) { rpcTerminationFutures.add(commonRpcService.stopService()); if (miniClusterConfiguration.getRpcServiceSharing() != MiniClusterConfiguration.RpcServiceSharing.SHARED) { rpcTerminationFutures.add(jobManagerRpcService.stopService()); rpcTerminationFutures.add(resourceManagerRpcService.stopService()); for (RpcService taskManagerRpcService : taskManagerRpcServices) { rpcTerminationFutures.add(taskManagerRpcService.stopService()); } } commonRpcService = null; jobManagerRpcService = null; taskManagerRpcServices = null; resourceManagerRpcService = null; } return FutureUtils.completeAll(rpcTerminationFutures); }
@Nonnull private CompletionStage<Void> terminateRpcServices() { final int numRpcServices; if (miniClusterConfiguration.getRpcServiceSharing() == RpcServiceSharing.SHARED) { numRpcServices = 1; } else { numRpcServices = 1 + 2 + miniClusterConfiguration.getNumTaskManagers(); // common, JM, RM, TMs } final Collection<CompletableFuture<?>> rpcTerminationFutures = new ArrayList<>(numRpcServices); synchronized (lock) { rpcTerminationFutures.add(commonRpcService.stopService()); if (miniClusterConfiguration.getRpcServiceSharing() != RpcServiceSharing.SHARED) { rpcTerminationFutures.add(jobManagerRpcService.stopService()); rpcTerminationFutures.add(resourceManagerRpcService.stopService()); for (RpcService taskManagerRpcService : taskManagerRpcServices) { rpcTerminationFutures.add(taskManagerRpcService.stopService()); } } commonRpcService = null; jobManagerRpcService = null; taskManagerRpcServices = null; resourceManagerRpcService = null; } return FutureUtils.completeAll(rpcTerminationFutures); }
/** * Shuts the given rpc services down and waits for their termination. * * @param rpcServices to shut down * @param timeout for this operation * @throws InterruptedException if the operation has been interrupted * @throws ExecutionException if a problem occurred * @throws TimeoutException if a timeout occurred */ public static void terminateRpcServices( Time timeout, RpcService... rpcServices) throws InterruptedException, ExecutionException, TimeoutException { final Collection<CompletableFuture<?>> terminationFutures = new ArrayList<>(rpcServices.length); for (RpcService service : rpcServices) { if (service != null) { terminationFutures.add(service.stopService()); } } FutureUtils.waitForAll(terminationFutures).get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS); }
/** * Shuts the given rpc services down and waits for their termination. * * @param rpcServices to shut down * @param timeout for this operation * @throws InterruptedException if the operation has been interrupted * @throws ExecutionException if a problem occurred * @throws TimeoutException if a timeout occurred */ public static void terminateRpcServices( Time timeout, RpcService... rpcServices) throws InterruptedException, ExecutionException, TimeoutException { final Collection<CompletableFuture<?>> terminationFutures = new ArrayList<>(rpcServices.length); for (RpcService service : rpcServices) { if (service != null) { terminationFutures.add(service.stopService()); } } FutureUtils.waitForAll(terminationFutures).get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS); }
private CompletableFuture<Void> shutDownServices() { synchronized (lock) { Collection<CompletableFuture<Void>> terminationFutures = new ArrayList<>(3); Exception exception = null; try { blobCacheService.close(); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } try { metricRegistry.shutdown(); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } if (metricQueryServiceActorSystem != null) { terminationFutures.add(AkkaUtils.terminateActorSystem(metricQueryServiceActorSystem)); } try { highAvailabilityServices.close(); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } terminationFutures.add(rpcService.stopService()); terminationFutures.add(ExecutorUtils.nonBlockingShutdown(timeout.toMilliseconds(), TimeUnit.MILLISECONDS, executor)); if (exception != null) { terminationFutures.add(FutureUtils.completedExceptionally(exception)); } return FutureUtils.completeAll(terminationFutures); } }
private CompletableFuture<Void> shutDownServices() { synchronized (lock) { Collection<CompletableFuture<Void>> terminationFutures = new ArrayList<>(3); Exception exception = null; try { blobCacheService.close(); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } try { metricRegistry.shutdown(); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } try { highAvailabilityServices.close(); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } terminationFutures.add(rpcService.stopService()); terminationFutures.add(ExecutorUtils.nonBlockingShutdown(timeout.toMilliseconds(), TimeUnit.MILLISECONDS, executor)); if (exception != null) { terminationFutures.add(FutureUtils.completedExceptionally(exception)); } return FutureUtils.completeAll(terminationFutures); } }
private CompletableFuture<Void> shutDownServices() { synchronized (lock) { Collection<CompletableFuture<Void>> terminationFutures = new ArrayList<>(3); Exception exception = null; try { blobCacheService.close(); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } try { metricRegistry.shutdown(); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } if (metricQueryServiceActorSystem != null) { terminationFutures.add(AkkaUtils.terminateActorSystem(metricQueryServiceActorSystem)); } try { highAvailabilityServices.close(); } catch (Exception e) { exception = ExceptionUtils.firstOrSuppressed(e, exception); } terminationFutures.add(rpcService.stopService()); terminationFutures.add(ExecutorUtils.nonBlockingShutdown(timeout.toMilliseconds(), TimeUnit.MILLISECONDS, executor)); if (exception != null) { terminationFutures.add(FutureUtils.completedExceptionally(exception)); } return FutureUtils.completeAll(terminationFutures); } }
terminationFutures.add(commonRpcService.stopService());