Class RangePublisher
- java.lang.Object
-
- org.reactivestreams.example.unicast.RangePublisher
-
- All Implemented Interfaces:
Publisher<java.lang.Integer>
public final class RangePublisher extends java.lang.Object implements Publisher<java.lang.Integer>
A synchronous implementation of thePublisherthat can be subscribed to multiple times and each individual subscription will receive range of monotonically increasing integer values on demand.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classRangePublisher.RangeSubscriptionA Subscription implementation that holds the current downstream requested amount and responds to the downstream's request() and cancel() calls.
-
Constructor Summary
Constructors Constructor Description RangePublisher(int start, int count)Constructs a RangePublisher instance with the given start and count values that yields a sequence of [start, start + count).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidsubscribe(Subscriber<? super java.lang.Integer> subscriber)RequestPublisherto start streaming data.
-
-
-
Method Detail
-
subscribe
public void subscribe(Subscriber<? super java.lang.Integer> subscriber)
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<java.lang.Integer>- Parameters:
subscriber- theSubscriberthat will consume signals from thisPublisher
-
-