@Test public void testComplete() { BufferedEmittingPublisher<Long> publisher = new BufferedEmittingPublisher<Long>(){}; TestSubscriber<Long> subscriber = new TestSubscriber<>(); publisher.subscribe(subscriber); publisher.complete(); assertThat(subscriber.isComplete(), is(equalTo(true))); assertThat(publisher.isCompleted(), is(equalTo(true))); assertThat(subscriber.getLastError(), is(nullValue())); }
public void complete() { if (state.compareAndSet(State.READY_TO_EMIT, State.COMPLETING)) { State.READY_TO_EMIT.drain(this); } }
BufferedEmittingPublisher implements Flow.Publisher<T> { public void complete() { if (state.compareAndSet(State.READY_TO_EMIT, State.COMPLETING)) { State.READY_TO_EMIT.drain(this); } } }
BufferedEmittingPublisher implements Flow.Publisher<T> { public void complete() { if (state.compareAndSet(State.READY_TO_EMIT, State.COMPLETING)) { State.READY_TO_EMIT.drain(this); } } protected  BufferedEmittingPublisher(); }
BufferedEmittingPublisher implements Flow.Publisher<T> { public void complete() { if (state.compareAndSet(State.READY_TO_EMIT, State.COMPLETING)) { State.READY_TO_EMIT.drain(this); } } protected  BufferedEmittingPublisher(); static BufferedEmittingPublisher<T> create(); @Override void subscribe(final Flow.Subscriber<? super T> subscriber); void onRequest(BiConsumer<Long, Long> requestCallback); void onEmit(Consumer<T> onEmitCallback); int emit(final T item); void fail(Throwable throwable); void complete(); void completeNow(); void clearBuffer(Consumer<T> consumer); boolean isUnbounded(); boolean hasRequests(); boolean isCompleted(); boolean isCancelled(); int bufferSize(); }
BufferedEmittingPublisher implements Flow.Publisher<T> { public void complete() { if (state.compareAndSet(State.READY_TO_EMIT, State.COMPLETING)) { State.READY_TO_EMIT.drain(this); } } protected  BufferedEmittingPublisher(); static BufferedEmittingPublisher<T> create(); @Override void subscribe(final Flow.Subscriber<? super T> subscriber); void onRequest(BiConsumer<Long, Long> requestCallback); void onEmit(Consumer<T> onEmitCallback); int emit(final T item); void fail(Throwable throwable); void complete(); void completeNow(); void clearBuffer(Consumer<T> consumer); boolean isUnbounded(); boolean hasRequests(); boolean isCompleted(); boolean isCancelled(); int bufferSize();  }