Module methanol
Class TimeoutSubscriber<T,S extends java.util.concurrent.Flow.Subscriber<? super T>>
- java.lang.Object
-
- com.github.mizosoft.methanol.internal.flow.ForwardingSubscriber<T>
-
- com.github.mizosoft.methanol.internal.flow.SerializedForwardingSubscriber<T>
-
- com.github.mizosoft.methanol.internal.flow.TimeoutSubscriber<T,S>
-
- 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.
-
-
Field Summary
-
Fields inherited from class com.github.mizosoft.methanol.internal.flow.ForwardingSubscriber
upstream
-
-
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 Sdelegate()Returns the downstream to which signals are forwarded.voidonComplete()voidonError(java.lang.Throwable throwable)voidonNext(T item)voidonSubscribe(java.util.concurrent.Flow.Subscription subscription)protected abstract java.lang.ThrowabletimeoutError(long index, java.time.Duration timeout)-
Methods inherited from class com.github.mizosoft.methanol.internal.flow.ForwardingSubscriber
toString
-
-
-
-
Method Detail
-
delegate
protected S delegate()
Description copied from class:ForwardingSubscriberReturns the downstream to which signals are forwarded.- Specified by:
delegatein classForwardingSubscriber<T>
-
onSubscribe
public void onSubscribe(java.util.concurrent.Flow.Subscription subscription)
- Specified by:
onSubscribein interfacejava.util.concurrent.Flow.Subscriber<T>- Overrides:
onSubscribein classSerializedForwardingSubscriber<T>
-
onNext
public void onNext(T item)
- Specified by:
onNextin interfacejava.util.concurrent.Flow.Subscriber<T>- Overrides:
onNextin classSerializedForwardingSubscriber<T>
-
onError
public void onError(java.lang.Throwable throwable)
- Specified by:
onErrorin interfacejava.util.concurrent.Flow.Subscriber<T>- Overrides:
onErrorin classSerializedForwardingSubscriber<T>
-
onComplete
public void onComplete()
- Specified by:
onCompletein interfacejava.util.concurrent.Flow.Subscriber<T>- Overrides:
onCompletein classSerializedForwardingSubscriber<T>
-
timeoutError
protected abstract java.lang.Throwable timeoutError(long index, java.time.Duration timeout)
-
-