Class BlockingMultiObserver<T>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) boolean cancelled  
      (package private) java.lang.Throwable error  
      (package private) Disposable upstream  
      (package private) T value  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean blockingAwait​(long timeout, java.util.concurrent.TimeUnit unit)
      Block until the observer terminates and return true; return false if the wait times out.
      void blockingConsume​(Consumer<? super T> onSuccess, Consumer<? super java.lang.Throwable> onError, Action onComplete)
      Blocks until the source completes and calls the appropriate callback.
      T blockingGet()
      Block until the latch is counted down then rethrow any exception received (wrapped if checked) or return the received value (null if none).
      T blockingGet​(T defaultValue)
      Block until the latch is counted down then rethrow any exception received (wrapped if checked) or return the received value (the defaultValue if none).
      (package private) void dispose()  
      void onComplete()
      Called once the deferred computation completes normally.
      void onError​(java.lang.Throwable e)
      Notifies the SingleObserver that the Single has experienced an error condition.
      void onSubscribe​(Disposable d)
      Provides the SingleObserver with the means of cancelling (disposing) the connection (channel) with the Single in both synchronous (from within onSubscribe(Disposable) itself) and asynchronous manner.
      void onSuccess​(T value)
      Notifies the SingleObserver with a single item and that the Single has finished sending push-based notifications.
      • 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
    • Field Detail

      • value

        T value
      • error

        java.lang.Throwable error
      • cancelled

        volatile boolean cancelled
    • Constructor Detail

      • BlockingMultiObserver

        public BlockingMultiObserver()
    • Method Detail

      • dispose

        void dispose()
      • blockingGet

        public T blockingGet()
        Block until the latch is counted down then rethrow any exception received (wrapped if checked) or return the received value (null if none).
        Returns:
        the value received or null if no value received
      • blockingGet

        public T blockingGet​(T defaultValue)
        Block until the latch is counted down then rethrow any exception received (wrapped if checked) or return the received value (the defaultValue if none).
        Parameters:
        defaultValue - the default value to return if no value was received
        Returns:
        the value received or defaultValue if no value received
      • blockingAwait

        public boolean blockingAwait​(long timeout,
                                     java.util.concurrent.TimeUnit unit)
        Block until the observer terminates and return true; return false if the wait times out.
        Parameters:
        timeout - the timeout value
        unit - the time unit
        Returns:
        true if the observer terminated in time, false otherwise
      • blockingConsume

        public void blockingConsume​(Consumer<? super T> onSuccess,
                                    Consumer<? super java.lang.Throwable> onError,
                                    Action onComplete)
        Blocks until the source completes and calls the appropriate callback.
        Parameters:
        onSuccess - for a succeeding source
        onError - for a failing source
        onComplete - for an empty source