Class ObservableStageObserver<T>

  • Type Parameters:
    T - the element type
    All Implemented Interfaces:
    Observer<T>, java.util.concurrent.CompletionStage<T>, java.util.concurrent.Future<T>
    Direct Known Subclasses:
    ObservableFirstStageObserver, ObservableLastStageObserver, ObservableSingleStageObserver

    abstract class ObservableStageObserver<T>
    extends java.util.concurrent.CompletableFuture<T>
    implements Observer<T>
    Base class that extends CompletableFuture and provides basic infrastructure to notify watchers upon upstream signals.
    Since:
    3.0.0
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.concurrent.CompletableFuture

        java.util.concurrent.CompletableFuture.AsynchronousCompletionTask
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.util.concurrent.atomic.AtomicReference<Disposable> upstream  
      (package private) T value  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean cancel​(boolean mayInterruptIfRunning)  
      protected void clear()  
      boolean complete​(T value)  
      boolean completeExceptionally​(java.lang.Throwable ex)  
      protected void disposeUpstream()  
      void onError​(java.lang.Throwable t)
      Notifies the Observer that the Observable has experienced an error condition.
      void onSubscribe​(@NonNull Disposable d)
      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.
      • Methods inherited from class java.util.concurrent.CompletableFuture

        acceptEither, acceptEitherAsync, acceptEitherAsync, allOf, anyOf, applyToEither, applyToEitherAsync, applyToEitherAsync, completeAsync, completeAsync, completedFuture, completedStage, completeOnTimeout, copy, defaultExecutor, delayedExecutor, delayedExecutor, exceptionally, failedFuture, failedStage, get, get, getNow, getNumberOfDependents, handle, handleAsync, handleAsync, isCancelled, isCompletedExceptionally, isDone, join, minimalCompletionStage, newIncompleteFuture, obtrudeException, obtrudeValue, orTimeout, runAfterBoth, runAfterBothAsync, runAfterBothAsync, runAfterEither, runAfterEitherAsync, runAfterEitherAsync, runAsync, runAsync, supplyAsync, supplyAsync, thenAccept, thenAcceptAsync, thenAcceptAsync, thenAcceptBoth, thenAcceptBothAsync, thenAcceptBothAsync, thenApply, thenApplyAsync, thenApplyAsync, thenCombine, thenCombineAsync, thenCombineAsync, thenCompose, thenComposeAsync, thenComposeAsync, thenRun, thenRunAsync, thenRunAsync, toCompletableFuture, toString, whenComplete, whenCompleteAsync, whenCompleteAsync
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • upstream

        final java.util.concurrent.atomic.AtomicReference<Disposable> upstream
      • value

        T value
    • Constructor Detail

      • ObservableStageObserver

        ObservableStageObserver()
    • Method Detail

      • onError

        public final void onError​(java.lang.Throwable t)
        Description copied from interface: Observer
        Notifies the Observer that the Observable has experienced an error condition.

        If the Observable calls this method, it will not thereafter call Observer.onNext(T) or Observer.onComplete().

        Specified by:
        onError in interface Observer<T>
        Parameters:
        t - the exception encountered by the Observable
      • disposeUpstream

        protected final void disposeUpstream()
      • clear

        protected final void clear()
      • cancel

        public final boolean cancel​(boolean mayInterruptIfRunning)
        Specified by:
        cancel in interface java.util.concurrent.Future<T>
        Overrides:
        cancel in class java.util.concurrent.CompletableFuture<T>
      • complete

        public final boolean complete​(T value)
        Overrides:
        complete in class java.util.concurrent.CompletableFuture<T>
      • completeExceptionally

        public final boolean completeExceptionally​(java.lang.Throwable ex)
        Overrides:
        completeExceptionally in class java.util.concurrent.CompletableFuture<T>