Class BufferItemMultiEmitter<T>
- java.lang.Object
-
- io.smallrye.mutiny.operators.multi.builders.BufferItemMultiEmitter<T>
-
- All Implemented Interfaces:
MultiEmitter<T>,org.reactivestreams.Subscription
public class BufferItemMultiEmitter<T> extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected MultiSubscriber<? super T>downstreamprotected java.util.concurrent.atomic.AtomicLongrequested
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()voidcomplete()Emits acompletionevent downstream indicating that no more item will be sent.voidcompletion()MultiEmitter<T>emit(T t)Emits anitemevent downstream.voidfail(java.lang.Throwable failure)Emits afailureevent downstream with the given exception.voidfailed(java.lang.Throwable failure)booleanisCancelled()MultiEmitter<T>onTermination(java.lang.Runnable onTermination)Attaches a @{code termination} event handler invoked when the downstreamSubscriptionis cancelled, or when the emitter has emitted either acompletionorfailureevent.voidrequest(long n)longrequested()MultiEmitter<T>serialize()
-
-
-
Field Detail
-
requested
protected final java.util.concurrent.atomic.AtomicLong requested
-
downstream
protected final MultiSubscriber<? super T> downstream
-
-
Method Detail
-
emit
public MultiEmitter<T> emit(T t)
Description copied from interface:MultiEmitterEmits anitemevent downstream.Calling this method after a failure or a completion events has no effect.
- Parameters:
t- the item, must not benull- Returns:
- this emitter, so firing item events can be chained.
-
failed
public void failed(java.lang.Throwable failure)
-
completion
public void completion()
-
requested
public long requested()
- Specified by:
requestedin interfaceMultiEmitter<T>- Returns:
- the current outstanding request amount.
-
complete
public void complete()
Description copied from interface:MultiEmitterEmits acompletionevent downstream indicating that no more item will be sent.Calling this method multiple times or after the
MultiEmitter.fail(Throwable)method has no effect.- Specified by:
completein interfaceMultiEmitter<T>
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelledin interfaceMultiEmitter<T>- Returns:
trueif the downstream cancelled the stream or the emitter was terminated (with a completion or failure events).
-
fail
public final void fail(java.lang.Throwable failure)
Description copied from interface:MultiEmitterEmits afailureevent downstream with the given exception.Calling this method multiple times or after the
MultiEmitter.complete()method has no effect.- Specified by:
failin interfaceMultiEmitter<T>- Parameters:
failure- the exception, must not benull
-
cancel
public final void cancel()
- Specified by:
cancelin interfaceorg.reactivestreams.Subscription
-
request
public final void request(long n)
- Specified by:
requestin interfaceorg.reactivestreams.Subscription
-
onTermination
public MultiEmitter<T> onTermination(java.lang.Runnable onTermination)
Description copied from interface:MultiEmitterAttaches a @{code termination} event handler invoked when the downstreamSubscriptionis cancelled, or when the emitter has emitted either acompletionorfailureevent.This method allows cleanup resources once the emitter can be disposed (has reached a terminal state).
If the registration of the
onTerminationcallback is done after the termination, it invokes the callback immediately.- Specified by:
onTerminationin interfaceMultiEmitter<T>- Parameters:
onTermination- the action to run on termination, must not benull- Returns:
- this emitter
-
serialize
public MultiEmitter<T> serialize()
-
-