ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/Flow.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/Flow.java (file contents):
Revision 1.11 by dl, Sun Jan 18 23:21:35 2015 UTC vs.
Revision 1.12 by dl, Sun Jan 18 23:52:16 2015 UTC

# Line 100 | Line 100 | import java.util.stream.Stream;
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   */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines