100 |
|
* public void onComplete() {} |
101 |
|
* }}</pre> |
102 |
|
* |
103 |
+ |
* <p>If there is no chance that a publisher will produce elements |
104 |
+ |
* faster than they can be consumed, a subscriber may initially |
105 |
+ |
* request an effectively unbounded number of items, as in: |
106 |
+ |
* |
107 |
+ |
* <pre> {@code |
108 |
+ |
* class UnboundedSubscriber<T> implements Subscriber<T> { |
109 |
+ |
* public void onSubscribe(Subscription subscription) { |
110 |
+ |
* subscription.request(Long.MAX_VALUE); // effectively unbounded |
111 |
+ |
* } |
112 |
+ |
* public void onNext(T item) { use(item); } |
113 |
+ |
* public void onError(Throwable ex) { ex.printStackTrace(); } |
114 |
+ |
* public void onComplete() {} |
115 |
+ |
* void use(T item) { ... } |
116 |
+ |
* }}</pre> |
117 |
+ |
|
118 |
|
* @author Doug Lea |
119 |
|
* @since 1.9 |
120 |
|
*/ |