Class BlockingBaseObserver<T>
- java.lang.Object
-
- java.util.concurrent.CountDownLatch
-
- io.reactivex.rxjava3.internal.observers.BlockingBaseObserver<T>
-
- All Implemented Interfaces:
Observer<T>,Disposable
- Direct Known Subclasses:
BlockingFirstObserver,BlockingLastObserver
public abstract class BlockingBaseObserver<T> extends java.util.concurrent.CountDownLatch implements Observer<T>, Disposable
-
-
Constructor Summary
Constructors Constructor Description BlockingBaseObserver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TblockingGet()Block until the first value arrives and return it, otherwise return null for an empty source and rethrow any exception.voiddispose()Dispose the resource, the operation should be idempotent.booleanisDisposed()Returns true if this resource has been disposed.voidonComplete()Notifies theObserverthat theObservablehas finished sending push-based notifications.voidonSubscribe(Disposable d)Provides theObserverwith the means of cancelling (disposing) the connection (channel) with theObservablein both synchronous (from withinObserver.onNext(Object)) and asynchronous manner.-
Methods inherited from class java.util.concurrent.CountDownLatch
await, await, countDown, getCount, toString
-
-
-
-
Field Detail
-
value
T value
-
error
java.lang.Throwable error
-
upstream
Disposable upstream
-
cancelled
volatile boolean cancelled
-
-
Method Detail
-
onSubscribe
public final void onSubscribe(Disposable d)
Description copied from interface:ObserverProvides theObserverwith the means of cancelling (disposing) the connection (channel) with theObservablein both synchronous (from withinObserver.onNext(Object)) and asynchronous manner.- Specified by:
onSubscribein interfaceObserver<T>- Parameters:
d- theDisposableinstance whoseDisposable.dispose()can be called anytime to cancel the connection
-
onComplete
public final void onComplete()
Description copied from interface:ObserverNotifies theObserverthat theObservablehas finished sending push-based notifications.The
Observablewill not call this method if it callsObserver.onError(java.lang.Throwable).- Specified by:
onCompletein interfaceObserver<T>
-
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
-
blockingGet
public final T blockingGet()
Block until the first value arrives and return it, otherwise return null for an empty source and rethrow any exception.- Returns:
- the first value or null if the source is empty
-
-