< prev index next >

src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java

Print this page




  82  * of elements requires a traversal of the elements, and so may report
  83  * inaccurate results if this collection is modified during traversal.
  84  *
  85  * <p>Bulk operations that add, remove, or examine multiple elements,
  86  * such as {@link #addAll}, {@link #removeIf} or {@link #forEach},
  87  * are <em>not</em> guaranteed to be performed atomically.
  88  * For example, a {@code forEach} traversal concurrent with an {@code
  89  * addAll} operation might observe only some of the added elements.
  90  *
  91  * <p>This class and its iterator implement all of the <em>optional</em>
  92  * methods of the {@link Queue} and {@link Iterator} interfaces.
  93  *
  94  * <p>Memory consistency effects: As with other concurrent
  95  * collections, actions in a thread prior to placing an object into a
  96  * {@code ConcurrentLinkedQueue}
  97  * <a href="package-summary.html#MemoryVisibility"><i>happen-before</i></a>
  98  * actions subsequent to the access or removal of that element from
  99  * the {@code ConcurrentLinkedQueue} in another thread.
 100  *
 101  * <p>This class is a member of the
 102  * <a href="{@docRoot}/java/util/package-summary.html#CollectionsFramework">
 103  * Java Collections Framework</a>.
 104  *
 105  * @since 1.5
 106  * @author Doug Lea
 107  * @param <E> the type of elements held in this queue
 108  */
 109 public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
 110         implements Queue<E>, java.io.Serializable {
 111     private static final long serialVersionUID = 196745693267521676L;
 112 
 113     /*
 114      * This is a modification of the Michael & Scott algorithm,
 115      * adapted for a garbage-collected environment, with support for
 116      * interior node deletion (to support e.g. remove(Object)).  For
 117      * explanation, read the paper.
 118      *
 119      * Note that like most non-blocking algorithms in this package,
 120      * this implementation relies on the fact that in garbage
 121      * collected systems, there is no possibility of ABA problems due
 122      * to recycled nodes, so there is no need to use "counted




  82  * of elements requires a traversal of the elements, and so may report
  83  * inaccurate results if this collection is modified during traversal.
  84  *
  85  * <p>Bulk operations that add, remove, or examine multiple elements,
  86  * such as {@link #addAll}, {@link #removeIf} or {@link #forEach},
  87  * are <em>not</em> guaranteed to be performed atomically.
  88  * For example, a {@code forEach} traversal concurrent with an {@code
  89  * addAll} operation might observe only some of the added elements.
  90  *
  91  * <p>This class and its iterator implement all of the <em>optional</em>
  92  * methods of the {@link Queue} and {@link Iterator} interfaces.
  93  *
  94  * <p>Memory consistency effects: As with other concurrent
  95  * collections, actions in a thread prior to placing an object into a
  96  * {@code ConcurrentLinkedQueue}
  97  * <a href="package-summary.html#MemoryVisibility"><i>happen-before</i></a>
  98  * actions subsequent to the access or removal of that element from
  99  * the {@code ConcurrentLinkedQueue} in another thread.
 100  *
 101  * <p>This class is a member of the
 102  * <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework">
 103  * Java Collections Framework</a>.
 104  *
 105  * @since 1.5
 106  * @author Doug Lea
 107  * @param <E> the type of elements held in this queue
 108  */
 109 public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
 110         implements Queue<E>, java.io.Serializable {
 111     private static final long serialVersionUID = 196745693267521676L;
 112 
 113     /*
 114      * This is a modification of the Michael & Scott algorithm,
 115      * adapted for a garbage-collected environment, with support for
 116      * interior node deletion (to support e.g. remove(Object)).  For
 117      * explanation, read the paper.
 118      *
 119      * Note that like most non-blocking algorithms in this package,
 120      * this implementation relies on the fact that in garbage
 121      * collected systems, there is no possibility of ABA problems due
 122      * to recycled nodes, so there is no need to use "counted


< prev index next >