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>
,java.io.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 java.util.concurrent.atomic.AtomicLong implements FlowableEmitter<T>, org.reactivestreams.Subscription
-
-
Field Summary
Fields Modifier and Type Field Description (package private) org.reactivestreams.Subscriber<? super T>
downstream
(package private) SequentialDisposable
serial
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description BaseEmitter(org.reactivestreams.Subscriber<? super T> downstream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
protected void
completeDownstream()
protected boolean
errorDownstream(java.lang.Throwable e)
boolean
isCancelled()
Returns true if the downstream cancelled the sequence or the emitter was terminated viaEmitter.onError(Throwable)
,Emitter.onComplete()
or a successfulFlowableEmitter.tryOnError(Throwable)
.void
onComplete()
Signal a completion.void
onError(java.lang.Throwable e)
Signal aThrowable
exception.(package private) void
onRequested()
(package private) void
onUnsubscribed()
void
request(long n)
long
requested()
The current outstanding request amount.FlowableEmitter<T>
serialize()
Ensures that calls toonNext
,onError
andonComplete
are properly serialized.void
setCancellable(Cancellable c)
Sets aCancellable
on this emitter; any previousDisposable
orCancellable
will be disposed/cancelled.void
setDisposable(Disposable d)
Sets a Disposable on this emitter; any previousDisposable
orCancellable
will be disposed/cancelled.boolean
signalError(java.lang.Throwable e)
java.lang.String
toString()
boolean
tryOnError(java.lang.Throwable e)
Attempts to emit the specifiedThrowable
error 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.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, weakCompareAndSetVolatile
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
downstream
final org.reactivestreams.Subscriber<? super T> downstream
-
serial
final SequentialDisposable serial
-
-
Constructor Detail
-
BaseEmitter
BaseEmitter(org.reactivestreams.Subscriber<? super T> downstream)
-
-
Method Detail
-
onComplete
public void onComplete()
Description copied from interface:Emitter
Signal a completion.- Specified by:
onComplete
in interfaceEmitter<T>
-
completeDownstream
protected void completeDownstream()
-
onError
public final void onError(java.lang.Throwable e)
Description copied from interface:Emitter
Signal aThrowable
exception.
-
tryOnError
public final boolean tryOnError(java.lang.Throwable e)
Description copied from interface:FlowableEmitter
Attempts to emit the specifiedThrowable
error 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.onError
is not called if the error could not be delivered.History: 2.1.1 - experimental
- Specified by:
tryOnError
in 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
public boolean signalError(java.lang.Throwable e)
-
errorDownstream
protected boolean errorDownstream(java.lang.Throwable e)
-
cancel
public final void cancel()
- Specified by:
cancel
in interfaceorg.reactivestreams.Subscription
-
onUnsubscribed
void onUnsubscribed()
-
isCancelled
public final boolean isCancelled()
Description copied from interface:FlowableEmitter
Returns 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:
isCancelled
in interfaceFlowableEmitter<T>
- Returns:
- true if the downstream cancelled the sequence or the emitter was terminated
-
request
public final void request(long n)
- Specified by:
request
in interfaceorg.reactivestreams.Subscription
-
onRequested
void onRequested()
-
setDisposable
public final void setDisposable(Disposable d)
Description copied from interface:FlowableEmitter
Sets a Disposable on this emitter; any previousDisposable
orCancellable
will be disposed/cancelled.This method is thread-safe.
- Specified by:
setDisposable
in interfaceFlowableEmitter<T>
- Parameters:
d
- the disposable,null
is allowed
-
setCancellable
public final void setCancellable(Cancellable c)
Description copied from interface:FlowableEmitter
Sets aCancellable
on this emitter; any previousDisposable
orCancellable
will be disposed/cancelled.This method is thread-safe.
- Specified by:
setCancellable
in interfaceFlowableEmitter<T>
- Parameters:
c
- theCancellable
resource,null
is allowed
-
requested
public final long requested()
Description copied from interface:FlowableEmitter
The current outstanding request amount.This method is thread-safe.
- Specified by:
requested
in interfaceFlowableEmitter<T>
- Returns:
- the current outstanding request amount
-
serialize
public final FlowableEmitter<T> serialize()
Description copied from interface:FlowableEmitter
Ensures that calls toonNext
,onError
andonComplete
are properly serialized.- Specified by:
serialize
in interfaceFlowableEmitter<T>
- Returns:
- the serialized
FlowableEmitter
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.util.concurrent.atomic.AtomicLong
-
-