Class FlowableCreate.SerializedEmitter<T>
java.lang.Object
java.lang.Number
java.util.concurrent.atomic.AtomicInteger
io.reactivex.rxjava3.internal.operators.flowable.FlowableCreate.SerializedEmitter<T>
- Type Parameters:
T- the value type
- All Implemented Interfaces:
Emitter<T>,FlowableEmitter<T>,Serializable
- Enclosing class:
FlowableCreate<T>
static final class FlowableCreate.SerializedEmitter<T>
extends AtomicInteger
implements FlowableEmitter<T>
Serializes calls to onNext, onError and onComplete.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) boolean(package private) final FlowableCreate.BaseEmitter<T> (package private) final AtomicThrowable(package private) final SimplePlainQueue<T> private static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voiddrain()(package private) voidbooleanReturns true if the downstream cancelled the sequence or the emitter was terminated viaEmitter.onError(Throwable),Emitter.onComplete()or a successfulFlowableEmitter.tryOnError(Throwable).voidSignal a completion.voidSignal aThrowableexception.voidSignal a normal value.longThe current outstanding request amount.Ensures that calls toonNext,onErrorandonCompleteare properly serialized.voidSets aCancellableon this emitter; any previousDisposableorCancellablewill be disposed/cancelled.voidSets a Disposable on this emitter; any previousDisposableorCancellablewill be disposed/cancelled.toString()booleanAttempts to emit the specifiedThrowableerror if the downstream hasn't cancelled the sequence or is otherwise terminated, returning false if the emission is not allowed to happen due to lifecycle restrictions.Methods inherited from class java.util.concurrent.atomic.AtomicInteger
accumulateAndGet, addAndGet, compareAndExchange, compareAndExchangeAcquire, compareAndExchangeRelease, compareAndSet, decrementAndGet, doubleValue, floatValue, get, getAcquire, getAndAccumulate, getAndAdd, getAndDecrement, getAndIncrement, getAndSet, getAndUpdate, getOpaque, getPlain, incrementAndGet, intValue, lazySet, longValue, set, setOpaque, setPlain, setRelease, updateAndGet, weakCompareAndSet, weakCompareAndSetAcquire, weakCompareAndSetPlain, weakCompareAndSetRelease, weakCompareAndSetVolatileMethods inherited from class java.lang.Number
byteValue, shortValue
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
emitter
-
errors
-
queue
-
done
volatile boolean done
-
-
Constructor Details
-
SerializedEmitter
SerializedEmitter(FlowableCreate.BaseEmitter<T> emitter)
-
-
Method Details
-
onNext
Description copied from interface:EmitterSignal a normal value. -
onError
Description copied from interface:EmitterSignal aThrowableexception. -
tryOnError
Description copied from interface:FlowableEmitterAttempts to emit the specifiedThrowableerror if the downstream hasn't cancelled the sequence or is otherwise terminated, returning false if the emission is not allowed to happen due to lifecycle restrictions.Unlike
Emitter.onError(Throwable), theRxjavaPlugins.onErroris not called if the error could not be delivered.History: 2.1.1 - experimental
- Specified by:
tryOnErrorin interfaceFlowableEmitter<T>- Parameters:
t- the throwable error to signal if possible- Returns:
- true if successful, false if the downstream is not able to accept further events
-
onComplete
public void onComplete()Description copied from interface:EmitterSignal a completion.- Specified by:
onCompletein interfaceEmitter<T>
-
drain
void drain() -
drainLoop
void drainLoop() -
setDisposable
Description copied from interface:FlowableEmitterSets a Disposable on this emitter; any previousDisposableorCancellablewill be disposed/cancelled.This method is thread-safe.
- Specified by:
setDisposablein interfaceFlowableEmitter<T>- Parameters:
d- the disposable,nullis allowed
-
setCancellable
Description copied from interface:FlowableEmitterSets aCancellableon this emitter; any previousDisposableorCancellablewill be disposed/cancelled.This method is thread-safe.
- Specified by:
setCancellablein interfaceFlowableEmitter<T>- Parameters:
c- theCancellableresource,nullis allowed
-
requested
public long requested()Description copied from interface:FlowableEmitterThe current outstanding request amount.This method is thread-safe.
- Specified by:
requestedin interfaceFlowableEmitter<T>- Returns:
- the current outstanding request amount
-
isCancelled
public boolean isCancelled()Description copied from interface:FlowableEmitterReturns true if the downstream cancelled the sequence or the emitter was terminated viaEmitter.onError(Throwable),Emitter.onComplete()or a successfulFlowableEmitter.tryOnError(Throwable).This method is thread-safe.
- Specified by:
isCancelledin interfaceFlowableEmitter<T>- Returns:
- true if the downstream cancelled the sequence or the emitter was terminated
-
serialize
Description copied from interface:FlowableEmitterEnsures that calls toonNext,onErrorandonCompleteare properly serialized.- Specified by:
serializein interfaceFlowableEmitter<T>- Returns:
- the serialized
FlowableEmitter
-
toString
- Overrides:
toStringin classAtomicInteger
-