Class BlockingBaseSubscriber<T>
java.lang.Object
java.util.concurrent.CountDownLatch
io.reactivex.rxjava3.internal.subscribers.BlockingBaseSubscriber<T>
- All Implemented Interfaces:
FlowableSubscriber<T>
,org.reactivestreams.Subscriber<T>
- Direct Known Subclasses:
BlockingFirstSubscriber
,BlockingLastSubscriber
public abstract class BlockingBaseSubscriber<T>
extends CountDownLatch
implements FlowableSubscriber<T>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal T
Block until the first value arrives and return it, otherwise return null for an empty source and rethrow any exception.final void
final void
onSubscribe
(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)
.Methods inherited from class java.util.concurrent.CountDownLatch
await, await, countDown, getCount, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.reactivestreams.Subscriber
onError, onNext
-
Field Details
-
Constructor Details
-
BlockingBaseSubscriber
public BlockingBaseSubscriber()
-
-
Method Details
-
onSubscribe
public final void onSubscribe(org.reactivestreams.Subscription s) Description copied from interface:FlowableSubscriber
Implementors 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:
onSubscribe
in interfaceFlowableSubscriber<T>
- Specified by:
onSubscribe
in interfaceorg.reactivestreams.Subscriber<T>
-
onComplete
public final void onComplete()- Specified by:
onComplete
in interfaceorg.reactivestreams.Subscriber<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
-