Package io.servicetalk.concurrent.api
Interface SingleTerminalSignalConsumer<T>
-
- Type Parameters:
T- Type of the result of theSingle.
public interface SingleTerminalSignalConsumer<T>A contract that provides discrete callbacks for various ways in which aSingleSource.Subscribercan terminate.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcancel()Callback to indicate termination viaCancellable.cancel().static <X> SingleTerminalSignalConsumer<X>from(java.lang.Runnable runnable)Create aSingleTerminalSignalConsumerwhere each method executes aRunnable.run().voidonError(java.lang.Throwable throwable)Callback to indicate termination viaSingleSource.Subscriber.onError(Throwable).voidonSuccess(T result)Callback to indicate termination viaSingleSource.Subscriber.onSuccess(Object).
-
-
-
Method Detail
-
onSuccess
void onSuccess(@Nullable T result)Callback to indicate termination viaSingleSource.Subscriber.onSuccess(Object).- Parameters:
result- the observed result of typeSingleTerminalSignalConsumer.
-
onError
void onError(java.lang.Throwable throwable)
Callback to indicate termination viaSingleSource.Subscriber.onError(Throwable).- Parameters:
throwable- the observedThrowable.
-
cancel
void cancel()
Callback to indicate termination viaCancellable.cancel().
-
from
static <X> SingleTerminalSignalConsumer<X> from(java.lang.Runnable runnable)
Create aSingleTerminalSignalConsumerwhere each method executes aRunnable.run().- Type Parameters:
X- The type ofSingleTerminalSignalConsumer.- Parameters:
runnable- TheRunnablewhich is invoked in each method of the returnedSingleTerminalSignalConsumer.- Returns:
- a
SingleTerminalSignalConsumerwhere each method executes aRunnable.run().
-
-