@Test public void testCheckFailed() { final Iterator<Stage<?>> futures = ImmutableList.<Stage<?>>of(f1, f2).iterator(); doReturn(futures).when(sources).iterator(); assertEquals(false, helper.failed.get()); assertEquals(false, helper.done.get()); assertNotNull(helper.sources); helper.checkFailed(); assertEquals(true, helper.failed.get()); assertEquals(false, helper.done.get()); assertNull(helper.sources); verify(f1, times(1)).cancel(); verify(f2, times(1)).cancel(); helper.checkFailed(); assertEquals(true, helper.failed.get()); assertEquals(false, helper.done.get()); assertNull(helper.sources); verify(f1, times(1)).cancel(); verify(f2, times(1)).cancel(); }
void checkFailed() { if (!failed.compareAndSet(false, true)) { return; } for (final Stage<?> source : sources) { source.cancel(); } sources = null; }
CollectHelper implements Handle<T> { void checkFailed() { if (!failed.compareAndSet(false, true)) { return; } for (final Stage<?> source : sources) { source.cancel(); } sources = null; } }
CollectHelper implements Handle<T> { void checkFailed() { if (!failed.compareAndSet(false, true)) { return; } for (final Stage<?> source : sources) { source.cancel(); } sources = null; } CollectHelper(
      int size, Function<? super Collection<T>, ? extends U> collector,
      Collection<? extends Stage<?>> sources, Completable<? super U> target
  ); }
CollectHelper implements Handle<T> { void checkFailed() { if (!failed.compareAndSet(false, true)) { return; } for (final Stage<?> source : sources) { source.cancel(); } sources = null; } CollectHelper(
      int size, Function<? super Collection<T>, ? extends U> collector,
      Collection<? extends Stage<?>> sources, Completable<? super U> target
  ); @Override void completed(T result); @Override void failed(Throwable e); @Override void cancelled(); }
CollectHelper implements Handle<T> { void checkFailed() { if (!failed.compareAndSet(false, true)) { return; } for (final Stage<?> source : sources) { source.cancel(); } sources = null; } CollectHelper(
      int size, Function<? super Collection<T>, ? extends U> collector,
      Collection<? extends Stage<?>> sources, Completable<? super U> target
  ); @Override void completed(T result); @Override void failed(Throwable e); @Override void cancelled();  }