Class DisposableAutoReleaseObserver<T>
java.lang.Object
java.util.concurrent.atomic.AtomicReference<Disposable>
io.reactivex.rxjava3.internal.observers.DisposableAutoReleaseObserver<T>
- Type Parameters:
T- the element type consumed
- All Implemented Interfaces:
Observer<T>, Disposable, LambdaConsumerIntrospection, Serializable
public final class DisposableAutoReleaseObserver<T>
extends AtomicReference<Disposable>
implements Observer<T>
Wraps lambda callbacks and when the upstream terminates or this observer gets disposed,
removes itself from a
CompositeDisposable.
History: 0.18.0 @ RxJavaExtensions
- Since:
- 3.1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDisposableAutoReleaseObserver(DisposableContainer composite, Consumer<? super T> onNext, Consumer<? super Throwable> onError, Action onComplete) -
Method Summary
Modifier and TypeMethodDescriptionfinal voiddispose()Dispose the resource, the operation should be idempotent.final booleanReturnstrueorfalseif a customonErrorconsumer has been provided.final booleanReturns true if this resource has been disposed.final voidfinal voidvoidProvides theObserverwith a new item to observe.final voidMethods inherited from class AtomicReference
accumulateAndGet, compareAndExchange, compareAndExchangeAcquire, compareAndExchangeRelease, compareAndSet, get, getAcquire, getAndAccumulate, getAndSet, getAndUpdate, getOpaque, getPlain, lazySet, set, setOpaque, setPlain, setRelease, toString, updateAndGet, weakCompareAndSet, weakCompareAndSetAcquire, weakCompareAndSetPlain, weakCompareAndSetRelease, weakCompareAndSetVolatileMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Observer
onComplete, onError, onSubscribe
-
Constructor Details
-
DisposableAutoReleaseObserver
-
-
Method Details
-
onNext
Description copied from interface:ObserverProvides theObserverwith a new item to observe.The
Observablemay call this method 0 or more times.The
Observablewill not call this method again after it calls eitherObserver.onComplete()orObserver.onError(Throwable). -
onError
-
onComplete
public final void onComplete() -
dispose
public final void dispose()Description copied from interface:DisposableDispose the resource, the operation should be idempotent.- Specified by:
disposein interfaceDisposable
-
isDisposed
public final boolean isDisposed()Description copied from interface:DisposableReturns true if this resource has been disposed.- Specified by:
isDisposedin interfaceDisposable- Returns:
- true if this resource has been disposed
-
onSubscribe
-
hasCustomOnError
public final boolean hasCustomOnError()Description copied from interface:LambdaConsumerIntrospectionReturnstrueorfalseif a customonErrorconsumer has been provided.- Specified by:
hasCustomOnErrorin interfaceLambdaConsumerIntrospection- Returns:
trueif a customonErrorconsumer implementation was supplied. Returnsfalseif the implementation is missing an error consumer and thus using a throwing default implementation.
-