Class MaybeCreate.Emitter<T>
java.lang.Object
java.util.concurrent.atomic.AtomicReference<Disposable>
io.reactivex.rxjava3.internal.operators.maybe.MaybeCreate.Emitter<T>
- All Implemented Interfaces:
MaybeEmitter<T>
,Disposable
,Serializable
- Enclosing class:
MaybeCreate<T>
static final class MaybeCreate.Emitter<T>
extends AtomicReference<Disposable>
implements MaybeEmitter<T>, Disposable
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final MaybeObserver
<? super T> private static final long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Dispose the resource, the operation should be idempotent.boolean
Returns true if the downstream disposed the sequence or the emitter was terminated viaMaybeEmitter.onSuccess(Object)
,MaybeEmitter.onError(Throwable)
,MaybeEmitter.onComplete()
or a successfulMaybeEmitter.tryOnError(Throwable)
.void
Signal the completion.void
Signal an exception.void
Signal a success value.void
Sets aCancellable
on this emitter; any previousDisposable
orCancellable
will be disposed/cancelled.void
Sets aDisposable
on this emitter; any previousDisposable
orCancellable
will be disposed/cancelled.toString()
boolean
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.AtomicReference
accumulateAndGet, compareAndExchange, compareAndExchangeAcquire, compareAndExchangeRelease, compareAndSet, get, getAcquire, getAndAccumulate, getAndSet, getAndUpdate, getOpaque, getPlain, lazySet, set, setOpaque, setPlain, setRelease, updateAndGet, weakCompareAndSet, weakCompareAndSetAcquire, weakCompareAndSetPlain, weakCompareAndSetRelease, weakCompareAndSetVolatile
-
Field Details
-
downstream
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
-
Constructor Details
-
Emitter
Emitter(MaybeObserver<? super T> downstream)
-
-
Method Details
-
onSuccess
Description copied from interface:MaybeEmitter
Signal a success value.- Specified by:
onSuccess
in interfaceMaybeEmitter<T>
- Parameters:
value
- the value, not null
-
onError
Description copied from interface:MaybeEmitter
Signal an exception.- Specified by:
onError
in interfaceMaybeEmitter<T>
- Parameters:
t
- the exception, notnull
-
tryOnError
Description copied from interface:MaybeEmitter
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
MaybeEmitter.onError(Throwable)
, theRxjavaPlugins.onError
is not called if the error could not be delivered.History: 2.1.1 - experimental
- Specified by:
tryOnError
in interfaceMaybeEmitter<T>
- Parameters:
t
- theThrowable
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:MaybeEmitter
Signal the completion.- Specified by:
onComplete
in interfaceMaybeEmitter<T>
-
setDisposable
Description copied from interface:MaybeEmitter
Sets aDisposable
on this emitter; any previousDisposable
orCancellable
will be disposed/cancelled.This method is thread-safe.
- Specified by:
setDisposable
in interfaceMaybeEmitter<T>
- Parameters:
d
- the disposable,null
is allowed
-
setCancellable
Description copied from interface:MaybeEmitter
Sets aCancellable
on this emitter; any previousDisposable
orCancellable
will be disposed/cancelled.This method is thread-safe.
- Specified by:
setCancellable
in interfaceMaybeEmitter<T>
- Parameters:
c
- theCancellable
resource,null
is allowed
-
dispose
public void dispose()Description copied from interface:Disposable
Dispose the resource, the operation should be idempotent.- Specified by:
dispose
in interfaceDisposable
-
isDisposed
public boolean isDisposed()Description copied from interface:MaybeEmitter
Returns true if the downstream disposed the sequence or the emitter was terminated viaMaybeEmitter.onSuccess(Object)
,MaybeEmitter.onError(Throwable)
,MaybeEmitter.onComplete()
or a successfulMaybeEmitter.tryOnError(Throwable)
.This method is thread-safe.
- Specified by:
isDisposed
in interfaceDisposable
- Specified by:
isDisposed
in interfaceMaybeEmitter<T>
- Returns:
- true if the downstream disposed the sequence or the emitter was terminated
-
toString
- Overrides:
toString
in classAtomicReference<Disposable>
-