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

Comparing jsr166/src/main/java/util/concurrent/SubmissionPublisher.java (file contents):
Revision 1.73 by jsr166, Sun Nov 26 20:35:30 2017 UTC vs.
Revision 1.74 by jsr166, Sun Nov 26 23:41:05 2017 UTC

# Line 15 | Line 15 | import java.util.concurrent.locks.LockSu
15   import java.util.function.BiConsumer;
16   import java.util.function.BiPredicate;
17   import java.util.function.Consumer;
18 < import static java.util.concurrent.Flow.*; // improve code readablitly
18 > import static java.util.concurrent.Flow.Publisher;
19 > import static java.util.concurrent.Flow.Subscriber;
20 > import static java.util.concurrent.Flow.Subscription;
21  
22   /**
23   * A {@link Flow.Publisher} that asynchronously issues submitted
# Line 196 | Line 198 | public class SubmissionPublisher<T> impl
198       * publishing. Unsubscribing occurs only during traversal loops,
199       * when BufferedSubscription methods return negative values
200       * signifying that they have been closed.  To reduce
201 <     * head-of-line blocking,  submit and offer methods first call
201 >     * head-of-line blocking, submit and offer methods first call
202       * BufferedSubscription.offer on each subscriber, and place
203       * saturated ones in retries list (using nextRetry field), and
204       * retry, possibly blocking or dropping.
# Line 352 | Line 354 | public class SubmissionPublisher<T> impl
354  
355      /**
356       * Common implementation for all three forms of submit and offer.
357 <     * Acts as submit if nanos == Long.MAX_VALUE, else offer
357 >     * Acts as submit if nanos == Long.MAX_VALUE, else offer.
358       */
359      private int doOffer(T item, long nanos,
360                          BiPredicate<Subscriber<? super T>, ? super T> onDrop) {
# Line 395 | Line 397 | public class SubmissionPublisher<T> impl
397  
398      /**
399       * Helps, (timed) waits for, and/or drops buffers on list; returns
400 <     * lag or negative drops (for use in offer)
400 >     * lag or negative drops (for use in offer).
401       */
402      private int retryOffer(T item, long nanos,
403                             BiPredicate<Subscriber<? super T>, ? super T> onDrop,
# Line 949 | Line 951 | public class SubmissionPublisher<T> impl
951       * subscribers per publisher).  We additionally segregate some
952       * fields that would otherwise nearly always encounter cache line
953       * contention among producers and consumers. To reduce contention
954 <     * acrosss time (vs space), consumers only periodically update
954 >     * across time (vs space), consumers only periodically update
955       * other fields (see method takeItems), at the expense of possibly
956       * staler reporting of lags and demand (bounded at 12.5% == 1/8
957       * capacity) and possibly more atomic operations.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines