Class SafeSubscriber<T>

  • Type Parameters:
    T - the value type
    All Implemented Interfaces:
    org.reactivestreams.Subscriber<T>, org.reactivestreams.Subscription

    public final class SafeSubscriber<T>
    extends java.lang.Object
    implements org.reactivestreams.Subscriber<T>, org.reactivestreams.Subscription
    Wraps another Subscriber and ensures all onXXX methods conform the protocol (except the requirement for serialized access).
    • Constructor Summary

      Constructors 
      Constructor Description
      SafeSubscriber​(org.reactivestreams.Subscriber<? super T> downstream)
      Constructs a SafeSubscriber by wrapping the given actual Subscriber.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cancel()  
      void onComplete()  
      void onError​(java.lang.Throwable t)  
      void onNext​(T t)  
      void onSubscribe​(org.reactivestreams.Subscription subscription)  
      void request​(long n)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SafeSubscriber

        public SafeSubscriber​(org.reactivestreams.Subscriber<? super T> downstream)
        Constructs a SafeSubscriber by wrapping the given actual Subscriber.
        Parameters:
        downstream - the actual Subscriber to wrap, not null (not validated)
    • Method Detail

      • onSubscribe

        public void onSubscribe​(org.reactivestreams.Subscription subscription)
        Specified by:
        onSubscribe in interface org.reactivestreams.Subscriber<T>
      • onNext

        public void onNext​(T t)
        Specified by:
        onNext in interface org.reactivestreams.Subscriber<T>
      • onError

        public void onError​(java.lang.Throwable t)
        Specified by:
        onError in interface org.reactivestreams.Subscriber<T>
      • onComplete

        public void onComplete()
        Specified by:
        onComplete in interface org.reactivestreams.Subscriber<T>
      • request

        public void request​(long n)
        Specified by:
        request in interface org.reactivestreams.Subscription
      • cancel

        public void cancel()
        Specified by:
        cancel in interface org.reactivestreams.Subscription