210 * collections are unshared, or are accessible only when
211 * holding other locks.
212 *
213 * <p id="Weakly">Most concurrent Collection implementations
214 * (including most Queues) also differ from the usual {@code java.util}
215 * conventions in that their {@linkplain java.util.Iterator Iterators}
216 * and {@linkplain java.util.Spliterator Spliterators} provide
217 * <em>weakly consistent</em> rather than fast-fail traversal:
218 * <ul>
219 * <li>they may proceed concurrently with other operations
220 * <li>they will never throw {@link java.util.ConcurrentModificationException
221 * ConcurrentModificationException}
222 * <li>they are guaranteed to traverse elements as they existed upon
223 * construction exactly once, and may (but are not guaranteed to)
224 * reflect any modifications subsequent to construction.
225 * </ul>
226 *
227 * <h2 id="MemoryVisibility">Memory Consistency Properties</h2>
228 *
229 * Chapter 17 of
230 * <cite>The Java™ Language Specification</cite> defines the
231 * <i>happens-before</i> relation on memory operations such as reads and
232 * writes of shared variables. The results of a write by one thread are
233 * guaranteed to be visible to a read by another thread only if the write
234 * operation <i>happens-before</i> the read operation. The
235 * {@code synchronized} and {@code volatile} constructs, as well as the
236 * {@code Thread.start()} and {@code Thread.join()} methods, can form
237 * <i>happens-before</i> relationships. In particular:
238 *
239 * <ul>
240 * <li>Each action in a thread <i>happens-before</i> every action in that
241 * thread that comes later in the program's order.
242 *
243 * <li>An unlock ({@code synchronized} block or method exit) of a
244 * monitor <i>happens-before</i> every subsequent lock ({@code synchronized}
245 * block or method entry) of that same monitor. And because
246 * the <i>happens-before</i> relation is transitive, all actions
247 * of a thread prior to unlocking <i>happen-before</i> all actions
248 * subsequent to any thread locking that monitor.
249 *
250 * <li>A write to a {@code volatile} field <i>happens-before</i> every
|
210 * collections are unshared, or are accessible only when
211 * holding other locks.
212 *
213 * <p id="Weakly">Most concurrent Collection implementations
214 * (including most Queues) also differ from the usual {@code java.util}
215 * conventions in that their {@linkplain java.util.Iterator Iterators}
216 * and {@linkplain java.util.Spliterator Spliterators} provide
217 * <em>weakly consistent</em> rather than fast-fail traversal:
218 * <ul>
219 * <li>they may proceed concurrently with other operations
220 * <li>they will never throw {@link java.util.ConcurrentModificationException
221 * ConcurrentModificationException}
222 * <li>they are guaranteed to traverse elements as they existed upon
223 * construction exactly once, and may (but are not guaranteed to)
224 * reflect any modifications subsequent to construction.
225 * </ul>
226 *
227 * <h2 id="MemoryVisibility">Memory Consistency Properties</h2>
228 *
229 * Chapter 17 of
230 * <cite>The Java Language Specification</cite> defines the
231 * <i>happens-before</i> relation on memory operations such as reads and
232 * writes of shared variables. The results of a write by one thread are
233 * guaranteed to be visible to a read by another thread only if the write
234 * operation <i>happens-before</i> the read operation. The
235 * {@code synchronized} and {@code volatile} constructs, as well as the
236 * {@code Thread.start()} and {@code Thread.join()} methods, can form
237 * <i>happens-before</i> relationships. In particular:
238 *
239 * <ul>
240 * <li>Each action in a thread <i>happens-before</i> every action in that
241 * thread that comes later in the program's order.
242 *
243 * <li>An unlock ({@code synchronized} block or method exit) of a
244 * monitor <i>happens-before</i> every subsequent lock ({@code synchronized}
245 * block or method entry) of that same monitor. And because
246 * the <i>happens-before</i> relation is transitive, all actions
247 * of a thread prior to unlocking <i>happen-before</i> all actions
248 * subsequent to any thread locking that monitor.
249 *
250 * <li>A write to a {@code volatile} field <i>happens-before</i> every
|