This commit is contained in:
Keith McGuigan 2011-04-22 08:46:51 -07:00
commit 5d6ff7b933
5 changed files with 47 additions and 21 deletions

View File

@ -59,10 +59,17 @@ import java.util.Queue;
* ConcurrentModificationException}, and may proceed concurrently with * ConcurrentModificationException}, and may proceed concurrently with
* other operations. * other operations.
* *
* <p>Beware that, unlike in most collections, the {@code size} * <p>Beware that, unlike in most collections, the {@code size} method
* method is <em>NOT</em> a constant-time operation. Because of the * is <em>NOT</em> a constant-time operation. Because of the
* asynchronous nature of these deques, determining the current number * asynchronous nature of these deques, determining the current number
* of elements requires a traversal of the elements. * of elements requires a traversal of the elements, and so may report
* inaccurate results if this collection is modified during traversal.
* Additionally, the bulk operations {@code addAll},
* {@code removeAll}, {@code retainAll}, {@code containsAll},
* {@code equals}, and {@code toArray} are <em>not</em> guaranteed
* to be performed atomically. For example, an iterator operating
* concurrently with an {@code addAll} operation might view only some
* of the added elements.
* *
* <p>This class and its iterator implement all of the <em>optional</em> * <p>This class and its iterator implement all of the <em>optional</em>
* methods of the {@link Deque} and {@link Iterator} interfaces. * methods of the {@link Deque} and {@link Iterator} interfaces.

View File

@ -72,7 +72,14 @@ import java.util.Queue;
* <p>Beware that, unlike in most collections, the {@code size} method * <p>Beware that, unlike in most collections, the {@code size} method
* is <em>NOT</em> a constant-time operation. Because of the * is <em>NOT</em> a constant-time operation. Because of the
* asynchronous nature of these queues, determining the current number * asynchronous nature of these queues, determining the current number
* of elements requires a traversal of the elements. * of elements requires a traversal of the elements, and so may report
* inaccurate results if this collection is modified during traversal.
* Additionally, the bulk operations {@code addAll},
* {@code removeAll}, {@code retainAll}, {@code containsAll},
* {@code equals}, and {@code toArray} are <em>not</em> guaranteed
* to be performed atomically. For example, an iterator operating
* concurrently with an {@code addAll} operation might view only some
* of the added elements.
* *
* <p>This class and its iterator implement all of the <em>optional</em> * <p>This class and its iterator implement all of the <em>optional</em>
* methods of the {@link Queue} and {@link Iterator} interfaces. * methods of the {@link Queue} and {@link Iterator} interfaces.

View File

@ -66,12 +66,13 @@ import java.util.concurrent.atomic.*;
* <p>Beware that, unlike in most collections, the <tt>size</tt> * <p>Beware that, unlike in most collections, the <tt>size</tt>
* method is <em>not</em> a constant-time operation. Because of the * method is <em>not</em> a constant-time operation. Because of the
* asynchronous nature of these maps, determining the current number * asynchronous nature of these maps, determining the current number
* of elements requires a traversal of the elements. Additionally, * of elements requires a traversal of the elements, and so may report
* the bulk operations <tt>putAll</tt>, <tt>equals</tt>, and * inaccurate results if this collection is modified during traversal.
* <tt>clear</tt> are <em>not</em> guaranteed to be performed * Additionally, the bulk operations <tt>putAll</tt>, <tt>equals</tt>,
* atomically. For example, an iterator operating concurrently with a * <tt>toArray</tt>, <tt>containsValue</tt>, and <tt>clear</tt> are
* <tt>putAll</tt> operation might view only some of the added * <em>not</em> guaranteed to be performed atomically. For example, an
* elements. * iterator operating concurrently with a <tt>putAll</tt> operation
* might view only some of the added elements.
* *
* <p>This class and its views and iterators implement all of the * <p>This class and its views and iterators implement all of the
* <em>optional</em> methods of the {@link Map} and {@link Iterator} * <em>optional</em> methods of the {@link Map} and {@link Iterator}
@ -1661,7 +1662,9 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
/** /**
* Returns <tt>true</tt> if this map maps one or more keys to the * Returns <tt>true</tt> if this map maps one or more keys to the
* specified value. This operation requires time linear in the * specified value. This operation requires time linear in the
* map size. * map size. Additionally, it is possible for the map to change
* during execution of this method, in which case the returned
* result may be inaccurate.
* *
* @param value value whose presence in this map is to be tested * @param value value whose presence in this map is to be tested
* @return <tt>true</tt> if a mapping to <tt>value</tt> exists; * @return <tt>true</tt> if a mapping to <tt>value</tt> exists;
@ -1751,7 +1754,7 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
* *
* @return a navigable set view of the keys in this map * @return a navigable set view of the keys in this map
*/ */
public NavigableSet<K> keySet() { public NavigableSet<K> keySet() {
KeySet ks = keySet; KeySet ks = keySet;
return (ks != null) ? ks : (keySet = new KeySet(this)); return (ks != null) ? ks : (keySet = new KeySet(this));
} }

View File

@ -58,12 +58,14 @@ import sun.misc.Unsafe;
* <p>Beware that, unlike in most collections, the <tt>size</tt> * <p>Beware that, unlike in most collections, the <tt>size</tt>
* method is <em>not</em> a constant-time operation. Because of the * method is <em>not</em> a constant-time operation. Because of the
* asynchronous nature of these sets, determining the current number * asynchronous nature of these sets, determining the current number
* of elements requires a traversal of the elements. Additionally, the * of elements requires a traversal of the elements, and so may report
* bulk operations <tt>addAll</tt>, <tt>removeAll</tt>, * inaccurate results if this collection is modified during traversal.
* <tt>retainAll</tt>, and <tt>containsAll</tt> are <em>not</em> * Additionally, the bulk operations <tt>addAll</tt>,
* guaranteed to be performed atomically. For example, an iterator * <tt>removeAll</tt>, <tt>retainAll</tt>, <tt>containsAll</tt>,
* operating concurrently with an <tt>addAll</tt> operation might view * <tt>equals</tt>, and <tt>toArray</tt> are <em>not</em> guaranteed
* only some of the added elements. * to be performed atomically. For example, an iterator operating
* concurrently with an <tt>addAll</tt> operation might view only some
* of the added elements.
* *
* <p>This class and its iterators implement all of the * <p>This class and its iterators implement all of the
* <em>optional</em> methods of the {@link Set} and {@link Iterator} * <em>optional</em> methods of the {@link Set} and {@link Iterator}

View File

@ -51,10 +51,17 @@ import java.util.concurrent.locks.LockSupport;
* producer. The <em>tail</em> of the queue is that element that has * producer. The <em>tail</em> of the queue is that element that has
* been on the queue the shortest time for some producer. * been on the queue the shortest time for some producer.
* *
* <p>Beware that, unlike in most collections, the {@code size} * <p>Beware that, unlike in most collections, the {@code size} method
* method is <em>NOT</em> a constant-time operation. Because of the * is <em>NOT</em> a constant-time operation. Because of the
* asynchronous nature of these queues, determining the current number * asynchronous nature of these queues, determining the current number
* of elements requires a traversal of the elements. * of elements requires a traversal of the elements, and so may report
* inaccurate results if this collection is modified during traversal.
* Additionally, the bulk operations {@code addAll},
* {@code removeAll}, {@code retainAll}, {@code containsAll},
* {@code equals}, and {@code toArray} are <em>not</em> guaranteed
* to be performed atomically. For example, an iterator operating
* concurrently with an {@code addAll} operation might view only some
* of the added elements.
* *
* <p>This class and its iterator implement all of the * <p>This class and its iterator implement all of the
* <em>optional</em> methods of the {@link Collection} and {@link * <em>optional</em> methods of the {@link Collection} and {@link