Class FutureSubscriber<T>
java.lang.Object
java.util.concurrent.CountDownLatch
io.reactivex.rxjava3.internal.subscribers.FutureSubscriber<T>
- Type Parameters:
T- the value type
- All Implemented Interfaces:
FlowableSubscriber<T>, Future<T>, org.reactivestreams.Subscriber<T>, org.reactivestreams.Subscription
public final class FutureSubscriber<T>
extends CountDownLatch
implements FlowableSubscriber<T>, Future<T>, org.reactivestreams.Subscription
A Subscriber + 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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()booleancancel(boolean mayInterruptIfRunning) get()booleanbooleanisDone()voidvoidvoidvoidonSubscribe(org.reactivestreams.Subscription s) Implementors of this method should make sure everything that needs to be visible inSubscriber.onNext(Object)is established before callingSubscription.request(long).voidrequest(long n) 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
-
FutureSubscriber
public FutureSubscriber()
-
-
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
public void onSubscribe(org.reactivestreams.Subscription s) Description copied from interface:FlowableSubscriberImplementors of this method should make sure everything that needs to be visible inSubscriber.onNext(Object)is established before callingSubscription.request(long). In practice this means no initialization should happen after therequest()call and additional behavior is thread safe in respect toonNext.- Specified by:
onSubscribein interfaceFlowableSubscriber<T>- Specified by:
onSubscribein interfaceorg.reactivestreams.Subscriber<T>
-
onNext
-
onError
-
onComplete
public void onComplete()- Specified by:
onCompletein interfaceorg.reactivestreams.Subscriber<T>
-
cancel
public void cancel()- Specified by:
cancelin interfaceorg.reactivestreams.Subscription
-
request
public void request(long n) - Specified by:
requestin interfaceorg.reactivestreams.Subscription
-