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
    Modifier and Type
    Field
    Description
    (package private) boolean
     
    (package private) Throwable
     
    (package private) org.reactivestreams.Subscription
     
    (package private) T
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final 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 in Subscriber.onNext(Object) is established before calling Subscription.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

    • value

      T value
    • error

      Throwable error
    • upstream

      org.reactivestreams.Subscription upstream
    • cancelled

      volatile boolean cancelled
  • 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 in Subscriber.onNext(Object) is established before calling Subscription.request(long). In practice this means no initialization should happen after the request() call and additional behavior is thread safe in respect to onNext.
      Specified by:
      onSubscribe in interface FlowableSubscriber<T>
      Specified by:
      onSubscribe in interface org.reactivestreams.Subscriber<T>
    • onComplete

      public final void onComplete()
      Specified by:
      onComplete in interface org.reactivestreams.Subscriber<T>
    • 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