public class UniSerializedSubscriber<T> extends Object implements UniSubscriber<T>, UniSubscription
UniSubscriber and UniSubscription making sure event handlers are only called once.| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Requests the
Uni to cancel and clean up resources. |
boolean |
isCancelledOrDone() |
void |
onFailure(Throwable failure)
Called if the computation of the item by the subscriber
Uni failed. |
void |
onItem(T item)
Event handler called once the item has been computed by the subscribed
Uni. |
void |
onSubscribe(UniSubscription subscription)
Event handler called once the subscribed
Uni has taken into account the subscription. |
static <T> void |
subscribe(AbstractUni<T> source,
UniSubscriber<? super T> subscriber) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitrequestpublic static <T> void subscribe(AbstractUni<T> source, UniSubscriber<? super T> subscriber)
public void onSubscribe(UniSubscription subscription)
UniSubscriberUni has taken into account the subscription. The Uni
have triggered the computation of the item.
IMPORTANT: UniSubscriber.onItem(Object) and UniSubscriber.onFailure(Throwable) would not be called
before the invocation of this method.
Uni.runSubscriptionOn(Executor) has been
calledUniSubscriber.onItem(Object) and
UniSubscriber.onFailure(Throwable) won't be calledonSubscribe in interface UniSubscriber<T>subscription - the subscription allowing to cancel the computation.public void onItem(T item)
UniSubscriberUni.
IMPORTANT: this method will be only called once per subscription. If
UniSubscriber.onFailure(Throwable) is called, this method won't be called.
Uni.emitOn(java.util.concurrent.Executor) has been calledonItem in interface UniSubscriber<T>item - the item, may be null.public void onFailure(Throwable failure)
UniSubscriberUni failed.
IMPORTANT: this method will be only called once per subscription. If
UniSubscriber.onItem(Object) is called, this method won't be called.
Uni.emitOn(java.util.concurrent.Executor) has been calledonFailure in interface UniSubscriber<T>failure - the failure, cannot be null.public void cancel()
UniSubscriptionUni to cancel and clean up resources.
If the item is retrieved after cancellation, it is not forwarded to the subscriber.
If the cancellation happens after the delivery of the item, this call is ignored.
Calling this method, emits the cancellation event upstream.
cancel in interface Cancellablecancel in interface UniSubscriptioncancel in interface org.reactivestreams.Subscriptionpublic boolean isCancelledOrDone()
Copyright © 2019–2020 SmallRye. All rights reserved.