code: 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);
  	}
docs: 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