core/src/main/java/org/apache/druid/common/guava/GuavaUtils.java
/**
   * Cancel futures manually, because sometime we can't cancel all futures in {@link com.google.common.util.concurrent.Futures.CombinedFuture}
   * automatically. Especially when we call
   * {@link  static <V> ListenableFuture<List<V>> com.google.common.util.concurrent.Futures#allAsList(Iterable<? extends ListenableFuture <? extends V>> futures)} to create a batch of
   * future.
   * @param mayInterruptIfRunning {@code true} if the thread executing this
   * task should be interrupted; otherwise, in-progress tasks are allowed
   * to complete
   * @param combinedFuture The combinedFuture that associated with futures
   * @param futures The futures that we want to cancel
   */
Cancel futures manually, because sometime we can't cancel all futures in  com.google.common.util.concurrent.Futures.CombinedFuture
automatically.
Cancel futures manually because sometime we can ' t cancel all futures in com . google . common . util . concurrent . Futures . CombinedFuture automatically .
public static <F extends Future<?>> void cancelAll(
      boolean mayInterruptIfRunning,
      @Nullable Future<?> combinedFuture,
      List<F> futures
  )
  {
    final List<Future> allFuturesToCancel = new ArrayList<>();
    allFuturesToCancel.add(combinedFuture);
    allFuturesToCancel.addAll(futures);
    if (allFuturesToCancel.isEmpty()) {
      return;
    }
    allFuturesToCancel.forEach(f -> {
      try {
        if (f != null) {
          f.cancel(mayInterruptIfRunning);
        }
      }
      catch (Throwable t) {
        log.warn(t, "Error while cancelling future.");
      }
    });
  }
public static < F extends Future < ? > > void cancelAll ( boolean mayInterruptIfRunning , @ Nullable Future < ? > combinedFuture , List < F > futures ) { final List < Future > allFuturesToCancel = new ArrayList < > ( ) ; allFuturesToCancel . add ( combinedFuture ) ; allFuturesToCancel . addAll ( futures ) ; if ( allFuturesToCancel . isEmpty ( ) ) { return ; } allFuturesToCancel . forEach ( f -> { try { if ( f != null ) { f . cancel ( mayInterruptIfRunning ) ; } } catch ( Throwable t ) { log . warn ( t , "Error while cancelling future." ) ; } } ) ; }
Cancel futures manually, because sometime we can't cancel all futures in {@link com.google.common.util.concurrent.Futures.CombinedFuture}
 automatically.
Cancel futures manually because sometime we can ' t cancel all futures in { @link com . google . common . util . concurrent . Futures . CombinedFuture } automatically .