@Test(expected = IllegalStateException.class) public void testAddWhenFinished() { helper.done.set(true); helper.add(CollectHelper.COMPLETED, null); }
void add(final byte type, final Object value) { final int w = write.getAndIncrement(); if (w < size) { writeAt(w, type, value); } final int c = countdown.decrementAndGet(); if (c < 0) { throw new IllegalStateException("already finished (countdown)"); } if (c != 0) { return; } if (!done.compareAndSet(false, true)) { throw new IllegalStateException("already finished"); } done(collect()); }
CollectHelper implements Handle<T> { void add(final byte type, final Object value) { final int w = write.getAndIncrement(); if (w < size) { writeAt(w, type, value); } final int c = countdown.decrementAndGet(); if (c < 0) { throw new IllegalStateException("already finished (countdown)"); } if (c != 0) { return; } if (!done.compareAndSet(false, true)) { throw new IllegalStateException("already finished"); } done(collect()); } }
CollectHelper implements Handle<T> { void add(final byte type, final Object value) { final int w = write.getAndIncrement(); if (w < size) { writeAt(w, type, value); } final int c = countdown.decrementAndGet(); if (c < 0) { throw new IllegalStateException("already finished (countdown)"); } if (c != 0) { return; } if (!done.compareAndSet(false, true)) { throw new IllegalStateException("already finished"); } done(collect()); } CollectHelper(
      int size, Function<? super Collection<T>, ? extends U> collector,
      Collection<? extends Stage<?>> sources, Completable<? super U> target
  ); }
CollectHelper implements Handle<T> { void add(final byte type, final Object value) { final int w = write.getAndIncrement(); if (w < size) { writeAt(w, type, value); } final int c = countdown.decrementAndGet(); if (c < 0) { throw new IllegalStateException("already finished (countdown)"); } if (c != 0) { return; } if (!done.compareAndSet(false, true)) { throw new IllegalStateException("already finished"); } done(collect()); } 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 add(final byte type, final Object value) { final int w = write.getAndIncrement(); if (w < size) { writeAt(w, type, value); } final int c = countdown.decrementAndGet(); if (c < 0) { throw new IllegalStateException("already finished (countdown)"); } if (c != 0) { return; } if (!done.compareAndSet(false, true)) { throw new IllegalStateException("already finished"); } done(collect()); } 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();  }