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 void
onComplete()
Successful terminal state.void
onError(java.lang.Throwable throwable)
Failed terminal state.void
onNext(T item)
Data notification sent by thePublisher
in response to requests toSubscription.request(long)
.void
onSubscribe(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:Subscriber
Invoked after callingPublisher.subscribe(Subscriber)
.No data will start flowing until
Subscription.request(long)
is invoked.It is the responsibility of this
Subscriber
instance to callSubscription.request(long)
whenever more data is wanted.The
Publisher
will send notifications only in response toSubscription.request(long)
.- Specified by:
onSubscribe
in interfaceSubscriber<T>
- Parameters:
subscription
- theSubscription
that allows requesting data viaSubscription.request(long)
-
onNext
public void onNext(T item)
Description copied from interface:Subscriber
Data notification sent by thePublisher
in response to requests toSubscription.request(long)
.- Specified by:
onNext
in interfaceSubscriber<T>
- Parameters:
item
- the element signaled
-
onError
public void onError(java.lang.Throwable throwable)
Description copied from interface:Subscriber
Failed terminal state.No further events will be sent even if
Subscription.request(long)
is invoked again.- Specified by:
onError
in interfaceSubscriber<T>
- Parameters:
throwable
- the throwable signaled
-
onComplete
public void onComplete()
Description copied from interface:Subscriber
Successful terminal state.No further events will be sent even if
Subscription.request(long)
is invoked again.- Specified by:
onComplete
in interfaceSubscriber<T>
-
-