64 * of elements requires a traversal of the elements, and so may report
65 * inaccurate results if this collection is modified during traversal.
66 *
67 * <p>Bulk operations that add, remove, or examine multiple elements,
68 * such as {@link #addAll}, {@link #removeIf} or {@link #forEach},
69 * are <em>not</em> guaranteed to be performed atomically.
70 * For example, a {@code forEach} traversal concurrent with an {@code
71 * addAll} operation might observe only some of the added elements.
72 *
73 * <p>This class and its iterator implement all of the <em>optional</em>
74 * methods of the {@link Collection} and {@link Iterator} interfaces.
75 *
76 * <p>Memory consistency effects: As with other concurrent
77 * collections, actions in a thread prior to placing an object into a
78 * {@code LinkedTransferQueue}
79 * <a href="package-summary.html#MemoryVisibility"><i>happen-before</i></a>
80 * actions subsequent to the access or removal of that element from
81 * the {@code LinkedTransferQueue} in another thread.
82 *
83 * <p>This class is a member of the
84 * <a href="{@docRoot}/java/util/package-summary.html#CollectionsFramework">
85 * Java Collections Framework</a>.
86 *
87 * @since 1.7
88 * @author Doug Lea
89 * @param <E> the type of elements held in this queue
90 */
91 public class LinkedTransferQueue<E> extends AbstractQueue<E>
92 implements TransferQueue<E>, java.io.Serializable {
93 private static final long serialVersionUID = -3223113410248163686L;
94
95 /*
96 * *** Overview of Dual Queues with Slack ***
97 *
98 * Dual Queues, introduced by Scherer and Scott
99 * (http://www.cs.rochester.edu/~scott/papers/2004_DISC_dual_DS.pdf)
100 * are (linked) queues in which nodes may represent either data or
101 * requests. When a thread tries to enqueue a data node, but
102 * encounters a request node, it instead "matches" and removes it;
103 * and vice versa for enqueuing requests. Blocking Dual Queues
104 * arrange that threads enqueuing unmatched requests block until
|
64 * of elements requires a traversal of the elements, and so may report
65 * inaccurate results if this collection is modified during traversal.
66 *
67 * <p>Bulk operations that add, remove, or examine multiple elements,
68 * such as {@link #addAll}, {@link #removeIf} or {@link #forEach},
69 * are <em>not</em> guaranteed to be performed atomically.
70 * For example, a {@code forEach} traversal concurrent with an {@code
71 * addAll} operation might observe only some of the added elements.
72 *
73 * <p>This class and its iterator implement all of the <em>optional</em>
74 * methods of the {@link Collection} and {@link Iterator} interfaces.
75 *
76 * <p>Memory consistency effects: As with other concurrent
77 * collections, actions in a thread prior to placing an object into a
78 * {@code LinkedTransferQueue}
79 * <a href="package-summary.html#MemoryVisibility"><i>happen-before</i></a>
80 * actions subsequent to the access or removal of that element from
81 * the {@code LinkedTransferQueue} in another thread.
82 *
83 * <p>This class is a member of the
84 * <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework">
85 * Java Collections Framework</a>.
86 *
87 * @since 1.7
88 * @author Doug Lea
89 * @param <E> the type of elements held in this queue
90 */
91 public class LinkedTransferQueue<E> extends AbstractQueue<E>
92 implements TransferQueue<E>, java.io.Serializable {
93 private static final long serialVersionUID = -3223113410248163686L;
94
95 /*
96 * *** Overview of Dual Queues with Slack ***
97 *
98 * Dual Queues, introduced by Scherer and Scott
99 * (http://www.cs.rochester.edu/~scott/papers/2004_DISC_dual_DS.pdf)
100 * are (linked) queues in which nodes may represent either data or
101 * requests. When a thread tries to enqueue a data node, but
102 * encounters a request node, it instead "matches" and removes it;
103 * and vice versa for enqueuing requests. Blocking Dual Queues
104 * arrange that threads enqueuing unmatched requests block until
|