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 CountDownLatch implements Observer<T>, Disposable
  • Field Details

    • value

      T value
    • error

      Throwable error
    • upstream

      Disposable upstream
    • cancelled

      volatile boolean cancelled
  • Constructor Details

    • BlockingBaseObserver

      public BlockingBaseObserver()
  • Method Details

    • onSubscribe

      public final void onSubscribe(Disposable d)
      Description copied from interface: Observer
      Provides the Observer with the means of cancelling (disposing) the connection (channel) with the Observable in both synchronous (from within Observer.onNext(Object)) and asynchronous manner.
      Specified by:
      onSubscribe in interface Observer<T>
      Parameters:
      d - the Disposable instance whose Disposable.dispose() can be called anytime to cancel the connection
    • onComplete

      public final void onComplete()
      Description copied from interface: Observer
      Notifies the Observer that the Observable has finished sending push-based notifications.

      The Observable will not call this method if it calls Observer.onError(java.lang.Throwable).

      Specified by:
      onComplete in interface Observer<T>
    • dispose

      public final void dispose()
      Description copied from interface: Disposable
      Dispose the resource, the operation should be idempotent.
      Specified by:
      dispose in interface Disposable
    • isDisposed

      public final boolean isDisposed()
      Description copied from interface: Disposable
      Returns true if this resource has been disposed.
      Specified by:
      isDisposed in interface Disposable
      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