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,java.io.Serializable
- Enclosing class:
- MaybeCreate<T>
static final class MaybeCreate.Emitter<T> extends java.util.concurrent.atomic.AtomicReference<Disposable> implements MaybeEmitter<T>, Disposable
-
-
Field Summary
Fields Modifier and Type Field Description (package private) MaybeObserver<? super T>downstreamprivate static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description Emitter(MaybeObserver<? super T> downstream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Dispose the resource, the operation should be idempotent.booleanisDisposed()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).voidonComplete()Signal the completion.voidonError(java.lang.Throwable t)Signal an exception.voidonSuccess(T value)Signal a success value.voidsetCancellable(Cancellable c)Sets aCancellableon this emitter; any previousDisposableorCancellablewill be disposed/cancelled.voidsetDisposable(Disposable d)Sets aDisposableon this emitter; any previousDisposableorCancellablewill be disposed/cancelled.java.lang.StringtoString()booleantryOnError(java.lang.Throwable t)Attempts 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.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 Detail
-
downstream
final MaybeObserver<? super T> downstream
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Emitter
Emitter(MaybeObserver<? super T> downstream)
-
-
Method Detail
-
onSuccess
public void onSuccess(T value)
Description copied from interface:MaybeEmitterSignal a success value.- Specified by:
onSuccessin interfaceMaybeEmitter<T>- Parameters:
value- the value, not null
-
onError
public void onError(java.lang.Throwable t)
Description copied from interface:MaybeEmitterSignal an exception.- Specified by:
onErrorin interfaceMaybeEmitter<T>- Parameters:
t- the exception, notnull
-
tryOnError
public boolean tryOnError(java.lang.Throwable t)
Description copied from interface:MaybeEmitterAttempts 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
MaybeEmitter.onError(Throwable), theRxjavaPlugins.onErroris not called if the error could not be delivered.History: 2.1.1 - experimental
- Specified by:
tryOnErrorin interfaceMaybeEmitter<T>- Parameters:
t- theThrowableerror 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:MaybeEmitterSignal the completion.- Specified by:
onCompletein interfaceMaybeEmitter<T>
-
setDisposable
public void setDisposable(Disposable d)
Description copied from interface:MaybeEmitterSets aDisposableon this emitter; any previousDisposableorCancellablewill be disposed/cancelled.This method is thread-safe.
- Specified by:
setDisposablein interfaceMaybeEmitter<T>- Parameters:
d- the disposable,nullis allowed
-
setCancellable
public void setCancellable(Cancellable c)
Description copied from interface:MaybeEmitterSets aCancellableon this emitter; any previousDisposableorCancellablewill be disposed/cancelled.This method is thread-safe.
- Specified by:
setCancellablein interfaceMaybeEmitter<T>- Parameters:
c- theCancellableresource,nullis allowed
-
dispose
public void dispose()
Description copied from interface:DisposableDispose the resource, the operation should be idempotent.- Specified by:
disposein interfaceDisposable
-
isDisposed
public boolean isDisposed()
Description copied from interface:MaybeEmitterReturns 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:
isDisposedin interfaceDisposable- Specified by:
isDisposedin interfaceMaybeEmitter<T>- Returns:
- true if the downstream disposed the sequence or the emitter was terminated
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.util.concurrent.atomic.AtomicReference<Disposable>
-
-