public final class TestCollectingCompletableSubscriber extends java.lang.Object implements CompletableSource.Subscriber
CompletableSource.Subscriber
that enqueues signals and provides blocking methods to consume them.Constructor and Description |
---|
TestCollectingCompletableSubscriber() |
Modifier and Type | Method and Description |
---|---|
void |
awaitOnComplete()
Block until a terminal signal is received, throws if
onError(Throwable) and returns normally if
onComplete() . |
java.lang.Throwable |
awaitOnError()
Block until a terminal signal is received, throws if
onComplete() and returns normally if
onError(Throwable) . |
Cancellable |
awaitSubscription()
Block until
onSubscribe(Cancellable) . |
void |
onComplete()
Success terminal state.
|
void |
onError(java.lang.Throwable t)
Failed terminal state.
|
void |
onSubscribe(Cancellable cancellable)
Called when the associated
CompletableSource is subscribed via
CompletableSource.subscribe(Subscriber) . |
boolean |
pollTerminal(long timeout,
java.util.concurrent.TimeUnit unit)
Block for a terminal event.
|
public void onSubscribe(Cancellable cancellable)
CompletableSource.Subscriber
CompletableSource
is subscribed via
CompletableSource.subscribe(Subscriber)
.onSubscribe
in interface CompletableSource.Subscriber
cancellable
- A Cancellable
that can be used to cancel the asynchronous computation for
this subscriber.public void onComplete()
CompletableSource.Subscriber
No further events will be sent.
onComplete
in interface CompletableSource.Subscriber
public void onError(java.lang.Throwable t)
CompletableSource.Subscriber
No further events will be sent.
onError
in interface CompletableSource.Subscriber
t
- the throwable signaledpublic Cancellable awaitSubscription() throws java.lang.InterruptedException
onSubscribe(Cancellable)
.PublisherSource.Subscription
from onSubscribe(Cancellable)
.java.lang.InterruptedException
- if an interrupt occurs while blocking for waiting for
onSubscribe(Cancellable)
.public java.lang.Throwable awaitOnError() throws java.lang.InterruptedException
onComplete()
and returns normally if
onError(Throwable)
.onError(Throwable)
.java.lang.InterruptedException
- If an interrupt occurs while blocking for the terminal event.public void awaitOnComplete() throws java.lang.InterruptedException
onError(Throwable)
and returns normally if
onComplete()
.java.lang.InterruptedException
- If an interrupt occurs while blocking for the terminal event.public boolean pollTerminal(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
timeout
- The duration of time to wait.unit
- The unit of time to apply to the duration.true
if a terminal event has been received before the timeout duration.java.lang.InterruptedException
- If an interrupt occurs while blocking for the terminal event.