Class TestSingleSubscriber<T>
java.lang.Object
io.servicetalk.concurrent.test.internal.TestSingleSubscriber<T>
- Type Parameters:
T- The type of data inonSuccess(Object).
- All Implemented Interfaces:
SingleSource.Subscriber<T>
A
SingleSource.Subscriber that enqueues signals and provides blocking methods to consume them.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBlock until a terminal signal is received, throws ifonSuccess(Object)and returns normally ifonError(Throwable).Block until a terminal signal is received, throws ifonError(Throwable)and returns normally ifonSuccess(Object).Block untilonSubscribe(Cancellable).voidFailed terminal state.voidonSubscribe(Cancellable cancellable) Called when the associatedSingleSourceis subscribed viaSingleSource.subscribe(Subscriber).voidSuccess terminal state.pollTerminal(long timeout, TimeUnit unit) Block for a terminal event.
-
Constructor Details
-
TestSingleSubscriber
public TestSingleSubscriber()
-
-
Method Details
-
onSubscribe
Description copied from interface:SingleSource.SubscriberCalled when the associatedSingleSourceis subscribed viaSingleSource.subscribe(Subscriber).- Specified by:
onSubscribein interfaceSingleSource.Subscriber<T>- Parameters:
cancellable- ACancellablethat can be used to cancel the asynchronous computation for this subscriber.
-
onSuccess
Description copied from interface:SingleSource.SubscriberSuccess terminal state.No further events will be sent.
- Specified by:
onSuccessin interfaceSingleSource.Subscriber<T>- Parameters:
result- of theSingleSource.
-
onError
Description copied from interface:SingleSource.SubscriberFailed terminal state.No further events will be sent.
- Specified by:
onErrorin interfaceSingleSource.Subscriber<T>- Parameters:
t- the throwable signaled.
-
awaitSubscription
Block untilonSubscribe(Cancellable).- Returns:
- The
PublisherSource.SubscriptionfromonSubscribe(Cancellable).
-
awaitOnError
Block until a terminal signal is received, throws ifonSuccess(Object)and returns normally ifonError(Throwable).- Returns:
- the exception received by
onError(Throwable).
-
awaitOnSuccess
Block until a terminal signal is received, throws ifonError(Throwable)and returns normally ifonSuccess(Object).- Returns:
- The value delivered to
onSuccess(Object).
-
pollTerminal
Block for a terminal event.- Parameters:
timeout- The duration of time to wait.unit- The unit of time to apply to the duration.- Returns:
nullif a the timeout expires before a terminal event is received. A non-nullSupplierthat returnsnullifonSuccess(Object), or theThrowablefromonError(Throwable).
-