Module methanol

Class TimeoutSubscriber<T,​S extends java.util.concurrent.Flow.Subscriber<? super T>>

  • All Implemented Interfaces:
    java.util.concurrent.Flow.Subscriber<T>
    Direct Known Subclasses:
    TimeoutBodySubscriber

    public abstract class TimeoutSubscriber<T,​S extends java.util.concurrent.Flow.Subscriber<? super T>>
    extends SerializedForwardingSubscriber<T>
    A subscriber that intercepts requests to upstream and schedules error completion if each requested item isn't received within a timeout.
    • Constructor Summary

      Constructors 
      Constructor Description
      TimeoutSubscriber​(S downstream, java.time.Duration timeout, Delayer delayer)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected S delegate()
      Returns the downstream to which signals are forwarded.
      void onComplete()  
      void onError​(java.lang.Throwable throwable)  
      void onNext​(T item)  
      void onSubscribe​(java.util.concurrent.Flow.Subscription subscription)  
      protected abstract java.lang.Throwable timeoutError​(long index, java.time.Duration timeout)  
      • Methods inherited from class java.lang.Object

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

      • TimeoutSubscriber

        public TimeoutSubscriber​(S downstream,
                                 java.time.Duration timeout,
                                 Delayer delayer)
    • Method Detail

      • onSubscribe

        public void onSubscribe​(java.util.concurrent.Flow.Subscription subscription)
        Specified by:
        onSubscribe in interface java.util.concurrent.Flow.Subscriber<T>
        Overrides:
        onSubscribe in class SerializedForwardingSubscriber<T>
      • onError

        public void onError​(java.lang.Throwable throwable)
        Specified by:
        onError in interface java.util.concurrent.Flow.Subscriber<T>
        Overrides:
        onError in class SerializedForwardingSubscriber<T>
      • timeoutError

        protected abstract java.lang.Throwable timeoutError​(long index,
                                                            java.time.Duration timeout)