Class FlowAdapters.ReactiveToFlowProcessor<T,U>
- java.lang.Object
-
- org.reactivestreams.FlowAdapters.ReactiveToFlowProcessor<T,U>
-
- Type Parameters:
T- the input typeU- the output type
- All Implemented Interfaces:
Processor<T,U>,Publisher<U>,Subscriber<T>
- Enclosing class:
- FlowAdapters
static final class FlowAdapters.ReactiveToFlowProcessor<T,U> extends java.lang.Object implements Processor<T,U>
Wraps a Flow Processor and forwards methods of the Reactive Streams Processor to it.
-
-
Constructor Summary
Constructors Constructor Description ReactiveToFlowProcessor(java.util.concurrent.Flow.Processor<? super T,? extends U> flow)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonComplete()Successful terminal state.voidonError(java.lang.Throwable t)Failed terminal state.voidonNext(T t)Data notification sent by thePublisherin response to requests toSubscription.request(long).voidonSubscribe(Subscription subscription)Invoked after callingPublisher.subscribe(Subscriber).voidsubscribe(Subscriber<? super U> s)RequestPublisherto start streaming data.
-
-
-
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 t)
Description copied from interface:SubscriberData notification sent by thePublisherin response to requests toSubscription.request(long).- Specified by:
onNextin interfaceSubscriber<T>- Parameters:
t- the element signaled
-
onError
public void onError(java.lang.Throwable t)
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:
t- 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>
-
subscribe
public void subscribe(Subscriber<? super U> s)
Description copied from interface:PublisherRequestPublisherto start streaming data.This is a "factory method" and can be called multiple times, each time starting a new
Subscription.Each
Subscriptionwill work for only a singleSubscriber.A
Subscribershould only subscribe once to a singlePublisher.If the
Publisherrejects the subscription attempt or otherwise fails it will signal the error viaSubscriber.onError(Throwable).- Specified by:
subscribein interfacePublisher<T>- Parameters:
s- theSubscriberthat will consume signals from thisPublisher
-
-