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 T
blockingGet()
Block until the first value arrives and return it, otherwise return null for an empty source and rethrow any exception.void
dispose()
Dispose the resource, the operation should be idempotent.boolean
isDisposed()
Returns true if this resource has been disposed.void
onComplete()
Notifies theObserver
that theObservable
has finished sending push-based notifications.void
onSubscribe(Disposable d)
Provides theObserver
with the means of cancelling (disposing) the connection (channel) with theObservable
in 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:Observer
Provides theObserver
with the means of cancelling (disposing) the connection (channel) with theObservable
in both synchronous (from withinObserver.onNext(Object)
) and asynchronous manner.- Specified by:
onSubscribe
in interfaceObserver<T>
- Parameters:
d
- theDisposable
instance whoseDisposable.dispose()
can be called anytime to cancel the connection
-
onComplete
public final void onComplete()
Description copied from interface:Observer
Notifies theObserver
that theObservable
has finished sending push-based notifications.The
Observable
will not call this method if it callsObserver.onError(java.lang.Throwable)
.- Specified by:
onComplete
in interfaceObserver<T>
-
dispose
public final void dispose()
Description copied from interface:Disposable
Dispose the resource, the operation should be idempotent.- Specified by:
dispose
in interfaceDisposable
-
isDisposed
public final boolean isDisposed()
Description copied from interface:Disposable
Returns true if this resource has been disposed.- Specified by:
isDisposed
in 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
-
-