Class SafeObserver<T>

java.lang.Object
io.reactivex.rxjava3.observers.SafeObserver<T>
Type Parameters:
T - the value type
All Implemented Interfaces:
Observer<T>, Disposable

public final class SafeObserver<T> extends Object implements Observer<T>, Disposable
Wraps another Observer and ensures all onXXX methods conform the protocol (except the requirement for serialized access).
  • Field Details

    • downstream

      final Observer<? super T> downstream
      The actual Subscriber.
    • upstream

      Disposable upstream
      The subscription.
    • done

      boolean done
      Indicates a terminal state.
  • Constructor Details

    • SafeObserver

      public SafeObserver(@NonNull @NonNull Observer<? super T> downstream)
      Constructs a SafeObserver by wrapping the given actual Observer.
      Parameters:
      downstream - the actual Observer to wrap, not null (not validated)
  • Method Details