Package io.smallrye.mutiny.operators.uni
Class UniOperatorProcessor<I,O>
- java.lang.Object
-
- io.smallrye.mutiny.operators.uni.UniOperatorProcessor<I,O>
-
- All Implemented Interfaces:
Cancellable,UniSubscriber<I>,UniSubscription,org.reactivestreams.Subscription
public abstract class UniOperatorProcessor<I,O> extends java.lang.Object implements UniSubscriber<I>, UniSubscription
-
-
Field Summary
Fields Modifier and Type Field Description protected UniSubscriber<? super O>downstreamprotected java.util.concurrent.atomic.AtomicReference<UniSubscription>upstream
-
Constructor Summary
Constructors Constructor Description UniOperatorProcessor(UniSubscriber<? super O> downstream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Requests theUnito cancel and clean up resources.booleanisCancelled()voidonFailure(java.lang.Throwable failure)Called if the computation of the item by the subscriberUnifailed.voidonItem(I item)Event handler called once the item has been computed by the subscribedUni.voidonSubscribe(UniSubscription subscription)Event handler called once the subscribedUnihas taken into account the subscription.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.smallrye.mutiny.subscription.UniSubscription
request
-
-
-
-
Field Detail
-
downstream
protected final UniSubscriber<? super O> downstream
-
upstream
protected final java.util.concurrent.atomic.AtomicReference<UniSubscription> upstream
-
-
Constructor Detail
-
UniOperatorProcessor
public UniOperatorProcessor(UniSubscriber<? super O> downstream)
-
-
Method Detail
-
onSubscribe
public void onSubscribe(UniSubscription subscription)
Description copied from interface:UniSubscriberEvent handler called once the subscribedUnihas taken into account the subscription. TheUnihave triggered the computation of the item. IMPORTANT:UniSubscriber.onItem(Object)andUniSubscriber.onFailure(Throwable)would not be called before the invocation of this method.- Executor: Operate on no particular executor, except if
Uni.runSubscriptionOn(Executor)has been called - Exception: Throwing an exception cancels the subscription,
UniSubscriber.onItem(Object)andUniSubscriber.onFailure(Throwable)won't be called
- Specified by:
onSubscribein interfaceUniSubscriber<I>- Parameters:
subscription- the subscription allowing to cancel the computation.
- Executor: Operate on no particular executor, except if
-
onItem
public void onItem(I item)
Description copied from interface:UniSubscriberEvent handler called once the item has been computed by the subscribedUni. IMPORTANT: this method will be only called once per subscription. IfUniSubscriber.onFailure(Throwable)is called, this method won't be called.- Executor: Operate on no particular executor, except if
Uni.emitOn(java.util.concurrent.Executor)has been called - Exception: Throwing an exception cancels the subscription.
- Specified by:
onItemin interfaceUniSubscriber<I>- Parameters:
item- the item, may benull.
- Executor: Operate on no particular executor, except if
-
onFailure
public void onFailure(java.lang.Throwable failure)
Description copied from interface:UniSubscriberCalled if the computation of the item by the subscriberUnifailed. IMPORTANT: this method will be only called once per subscription. IfUniSubscriber.onItem(Object)is called, this method won't be called.- Executor: Operate on no particular executor, except if
Uni.emitOn(java.util.concurrent.Executor)has been called - Exception: Throwing an exception cancels the subscription.
- Specified by:
onFailurein interfaceUniSubscriber<I>- Parameters:
failure- the failure, cannot benull.
- Executor: Operate on no particular executor, except if
-
cancel
public void cancel()
Description copied from interface:UniSubscriptionRequests theUnito 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
cancellationevent upstream.- Specified by:
cancelin interfaceCancellable- Specified by:
cancelin interfaceorg.reactivestreams.Subscription- Specified by:
cancelin interfaceUniSubscription
-
isCancelled
public boolean isCancelled()
-
-