Package org.reactivestreams
Class FlowAdapters.ReactiveToFlowSubscriber<T>
- java.lang.Object
-
- org.reactivestreams.FlowAdapters.ReactiveToFlowSubscriber<T>
-
- Type Parameters:
T- the element type
- All Implemented Interfaces:
Subscriber<T>
- Enclosing class:
- FlowAdapters
static final class FlowAdapters.ReactiveToFlowSubscriber<T> extends java.lang.Object implements Subscriber<T>
Wraps a Flow Subscriber and forwards methods of the Reactive Streams Subscriber to it.
-
-
Constructor Summary
Constructors Constructor Description ReactiveToFlowSubscriber(java.util.concurrent.Flow.Subscriber<? super T> flow)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonComplete()Successful terminal state.voidonError(java.lang.Throwable throwable)Failed terminal state.voidonNext(T item)Data notification sent by thePublisherin response to requests toSubscription.request(long).voidonSubscribe(Subscription subscription)Invoked after callingPublisher.subscribe(Subscriber).
-
-
-
Field Detail
-
flow
final java.util.concurrent.Flow.Subscriber<? super T> flow
-
-
Constructor Detail
-
ReactiveToFlowSubscriber
public ReactiveToFlowSubscriber(java.util.concurrent.Flow.Subscriber<? super T> flow)
-
-
Method Detail
-
onSubscribe
public void onSubscribe(Subscription subscription)
Description copied from interface:SubscriberInvoked after callingPublisher.subscribe(Subscriber).No data will start flowing until
Subscription.request(long)is invoked.It is the responsibility of this
Subscriberinstance to callSubscription.request(long)whenever more data is wanted.The
Publisherwill send notifications only in response toSubscription.request(long).- Specified by:
onSubscribein interfaceSubscriber<T>- Parameters:
subscription- theSubscriptionthat allows requesting data viaSubscription.request(long)
-
onNext
public void onNext(T item)
Description copied from interface:SubscriberData notification sent by thePublisherin response to requests toSubscription.request(long).- Specified by:
onNextin interfaceSubscriber<T>- Parameters:
item- the element signaled
-
onError
public void onError(java.lang.Throwable throwable)
Description copied from interface:SubscriberFailed terminal state.No further events will be sent even if
Subscription.request(long)is invoked again.- Specified by:
onErrorin interfaceSubscriber<T>- Parameters:
throwable- the throwable signaled
-
onComplete
public void onComplete()
Description copied from interface:SubscriberSuccessful terminal state.No further events will be sent even if
Subscription.request(long)is invoked again.- Specified by:
onCompletein interfaceSubscriber<T>
-
-