@Test public void collectInterrupts() { AtomicReference<Throwable> p1Intr = new AtomicReference<>(); AtomicReference<Throwable> p2Intr = new AtomicReference<>(); AtomicReference<Throwable> p3Intr = new AtomicReference<>(); Promise<Integer> p1 = Promise.apply(p1Intr::set); Promise<Integer> p2 = Promise.apply(p2Intr::set); Promise<Integer> p3 = Promise.apply(p3Intr::set); Future<List<Integer>> future = Future.collect(Arrays.asList(p1, p2, p3)); future.raise(ex); assertEquals(ex, p1Intr.get()); assertEquals(ex, p2Intr.get()); assertEquals(ex, p3Intr.get()); }
@SuppressWarnings("unchecked") public final void collect(final T value, final int i) { results[i] = value; if (count.decrementAndGet() == 0) setValue((List<T>) Arrays.asList(results)); }
CollectPromise extends Promise<List<T>> { @SuppressWarnings("unchecked") public final void collect(final T value, final int i) { results[i] = value; if (count.decrementAndGet() == 0) setValue((List<T>) Arrays.asList(results)); } }
CollectPromise extends Promise<List<T>> { @SuppressWarnings("unchecked") public final void collect(final T value, final int i) { results[i] = value; if (count.decrementAndGet() == 0) setValue((List<T>) Arrays.asList(results)); } CollectPromise(final List<? extends Future<T>> list); }
CollectPromise extends Promise<List<T>> { @SuppressWarnings("unchecked") public final void collect(final T value, final int i) { results[i] = value; if (count.decrementAndGet() == 0) setValue((List<T>) Arrays.asList(results)); } CollectPromise(final List<? extends Future<T>> list); @SuppressWarnings("unchecked") final void collect(final T value, final int i); }
CollectPromise extends Promise<List<T>> { @SuppressWarnings("unchecked") public final void collect(final T value, final int i) { results[i] = value; if (count.decrementAndGet() == 0) setValue((List<T>) Arrays.asList(results)); } CollectPromise(final List<? extends Future<T>> list); @SuppressWarnings("unchecked") final void collect(final T value, final int i);  }