Class FutureMultiObserver<T>
java.lang.Object
java.util.concurrent.CountDownLatch
io.reactivex.rxjava3.internal.observers.FutureMultiObserver<T>
- Type Parameters:
T- the value type
- All Implemented Interfaces:
CompletableObserver, MaybeObserver<T>, SingleObserver<T>, Disposable, Future<T>
public final class FutureMultiObserver<T>
extends CountDownLatch
implements MaybeObserver<T>, SingleObserver<T>, CompletableObserver, Future<T>, Disposable
An Observer + Future that expects exactly one upstream value and provides it
via the (blocking) Future API.
-
Nested Class Summary
Nested classes/interfaces inherited from interface Future
Future.State -
Field Summary
FieldsModifier and TypeFieldDescription(package private) Throwable(package private) final AtomicReference<Disposable> (package private) T -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancancel(boolean mayInterruptIfRunning) voiddispose()Dispose the resource, the operation should be idempotent.get()booleanbooleanReturns true if this resource has been disposed.booleanisDone()voidCalled once the deferred computation completes normally.voidNotifies theMaybeObserverthat theMaybehas experienced an error condition.voidProvides theMaybeObserverwith the means of cancelling (disposing) the connection (channel) with theMaybein both synchronous (from withinonSubscribe(Disposable)itself) and asynchronous manner.voidNotifies theMaybeObserverwith one item and that theMaybehas finished sending push-based notifications.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Future
exceptionNow, resultNow, state
-
Field Details
-
Constructor Details
-
FutureMultiObserver
public FutureMultiObserver()
-
-
Method Details
-
cancel
-
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceFuture<T>
-
isDone
-
get
- Specified by:
getin interfaceFuture<T>- Throws:
InterruptedExceptionExecutionException
-
get
public T get(long timeout, @NonNull @NonNull TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
getin interfaceFuture<T>- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
onSubscribe
Description copied from interface:MaybeObserverProvides theMaybeObserverwith the means of cancelling (disposing) the connection (channel) with theMaybein both synchronous (from withinonSubscribe(Disposable)itself) and asynchronous manner.- Specified by:
onSubscribein interfaceCompletableObserver- Specified by:
onSubscribein interfaceMaybeObserver<T>- Specified by:
onSubscribein interfaceSingleObserver<T>- Parameters:
d- theDisposableinstance whoseDisposable.dispose()can be called anytime to cancel the connection
-
onSuccess
Description copied from interface:MaybeObserverNotifies theMaybeObserverwith one item and that theMaybehas finished sending push-based notifications.The
Maybewill not call this method if it callsMaybeObserver.onError(Throwable).- Specified by:
onSuccessin interfaceMaybeObserver<T>- Specified by:
onSuccessin interfaceSingleObserver<T>- Parameters:
t- the item emitted by theMaybe
-
onError
Description copied from interface:MaybeObserverNotifies theMaybeObserverthat theMaybehas experienced an error condition.If the
Maybecalls this method, it will not thereafter callMaybeObserver.onSuccess(T).- Specified by:
onErrorin interfaceCompletableObserver- Specified by:
onErrorin interfaceMaybeObserver<T>- Specified by:
onErrorin interfaceSingleObserver<T>- Parameters:
t- the exception encountered by theMaybe
-
onComplete
public void onComplete()Description copied from interface:MaybeObserverCalled once the deferred computation completes normally.- Specified by:
onCompletein interfaceCompletableObserver- Specified by:
onCompletein interfaceMaybeObserver<T>
-
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:DisposableReturns true if this resource has been disposed.- Specified by:
isDisposedin interfaceDisposable- Returns:
- true if this resource has been disposed
-