Class BufferItemMultiEmitter<T>
- java.lang.Object
-
- io.smallrye.mutiny.operators.multi.builders.BufferItemMultiEmitter<T>
-
- All Implemented Interfaces:
ContextSupport
,MultiEmitter<T>
,org.reactivestreams.Subscription
public class BufferItemMultiEmitter<T> extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BufferItemMultiEmitter.EmitterBufferOverflowException
-
Field Summary
Fields Modifier and Type Field Description protected MultiSubscriber<? super T>
downstream
protected java.util.concurrent.atomic.AtomicLong
requested
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
protected void
cleanup()
void
complete()
Emits acompletion
event downstream indicating that no more item will be sent.void
completion()
Context
context()
Provide a context.MultiEmitter<T>
emit(T t)
Emits anitem
event downstream.void
fail(java.lang.Throwable failure)
Emits afailure
event downstream with the given exception.void
failed(java.lang.Throwable failure)
boolean
isCancelled()
MultiEmitter<T>
onTermination(java.lang.Runnable onTermination)
Attaches a @{code termination} event handler invoked when the downstreamSubscription
is cancelled, or when the emitter has emitted either acompletion
orfailure
event.void
request(long n)
long
requested()
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:MultiEmitter
Emits anitem
event 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.
-
cleanup
protected void cleanup()
-
failed
public void failed(java.lang.Throwable failure)
-
completion
public void completion()
-
context
public Context context()
Description copied from interface:ContextSupport
Provide a context.Since calls to this method shall only be triggered when a Mutiny pipeline uses a
withContext
operator, there is no need in general for caching the context value in a field of the implementing class. Exceptions include operators that have cross-subscriber semantics such as memoizers or broadcasters.This method is expected to be called once per
withContext
operator.- Specified by:
context
in interfaceContextSupport
- Returns:
- the context, must not be
null
.
-
requested
public long requested()
- Specified by:
requested
in interfaceMultiEmitter<T>
- Returns:
- the current outstanding request amount.
-
complete
public void complete()
Description copied from interface:MultiEmitter
Emits acompletion
event 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:
complete
in interfaceMultiEmitter<T>
-
isCancelled
public boolean isCancelled()
- Specified by:
isCancelled
in interfaceMultiEmitter<T>
- Returns:
true
if 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:MultiEmitter
Emits afailure
event downstream with the given exception.Calling this method multiple times or after the
MultiEmitter.complete()
method has no effect.- Specified by:
fail
in interfaceMultiEmitter<T>
- Parameters:
failure
- the exception, must not benull
-
cancel
public final void cancel()
- Specified by:
cancel
in interfaceorg.reactivestreams.Subscription
-
request
public final void request(long n)
- Specified by:
request
in interfaceorg.reactivestreams.Subscription
-
onTermination
public MultiEmitter<T> onTermination(java.lang.Runnable onTermination)
Description copied from interface:MultiEmitter
Attaches a @{code termination} event handler invoked when the downstreamSubscription
is cancelled, or when the emitter has emitted either acompletion
orfailure
event.This method allows cleanup resources once the emitter can be disposed (has reached a terminal state).
If the registration of the
onTermination
callback is done after the termination, it invokes the callback immediately.- Specified by:
onTermination
in interfaceMultiEmitter<T>
- Parameters:
onTermination
- the action to run on termination, must not benull
- Returns:
- this emitter
-
serialize
public MultiEmitter<T> serialize()
-
-