Class FlowableCreate.BaseEmitter<T>
java.lang.Object
java.lang.Number
java.util.concurrent.atomic.AtomicLong
io.reactivex.rxjava3.internal.operators.flowable.FlowableCreate.BaseEmitter<T>
- All Implemented Interfaces:
Emitter<T>, FlowableEmitter<T>, Serializable, org.reactivestreams.Subscription
- Direct Known Subclasses:
FlowableCreate.BufferAsyncEmitter, FlowableCreate.LatestAsyncEmitter, FlowableCreate.MissingEmitter, FlowableCreate.NoOverflowBaseAsyncEmitter
- Enclosing class:
FlowableCreate<T>
abstract static class FlowableCreate.BaseEmitter<T>
extends AtomicLong
implements FlowableEmitter<T>, org.reactivestreams.Subscription
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final org.reactivestreams.Subscriber<? super T> (package private) final SequentialDisposableprivate static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidcancel()protected voidprotected booleanfinal booleanReturns 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.final voidSignal aThrowableexception.(package private) void(package private) voidfinal voidrequest(long n) final longThe current outstanding request amount.final FlowableEmitter<T> Ensures that calls toonNext,onErrorandonCompleteare properly serialized.final voidSets aCancellableon this emitter; any previousDisposableorCancellablewill be disposed/cancelled.final voidSets a Disposable on this emitter; any previousDisposableorCancellablewill be disposed/cancelled.booleantoString()final 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 AtomicLong
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 Number
byteValue, shortValue
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
downstream
-
serial
-
-
Constructor Details
-
BaseEmitter
BaseEmitter(org.reactivestreams.Subscriber<? super T> downstream)
-
-
Method Details
-
onComplete
public void onComplete()Description copied from interface:EmitterSignal a completion.- Specified by:
onCompletein interfaceEmitter<T>
-
completeDownstream
protected void completeDownstream() -
onError
-
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:
e- the throwable error to signal if possible- Returns:
- true if successful, false if the downstream is not able to accept further events
-
signalError
-
errorDownstream
-
cancel
public final void cancel()- Specified by:
cancelin interfaceorg.reactivestreams.Subscription
-
onUnsubscribed
void onUnsubscribed() -
isCancelled
public final 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
-
request
public final void request(long n) - Specified by:
requestin interfaceorg.reactivestreams.Subscription
-
onRequested
void onRequested() -
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 final 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
-
serialize
Description copied from interface:FlowableEmitterEnsures that calls toonNext,onErrorandonCompleteare properly serialized.- Specified by:
serializein interfaceFlowableEmitter<T>- Returns:
- the serialized
FlowableEmitter
-
toString
- Overrides:
toStringin classAtomicLong
-