提交 4beadf72 编写于 作者: D dl

7038885: Improved bulk operation disclaimers for concurrent collections

Reviewed-by: chegar
上级 40c0d385
......@@ -59,10 +59,17 @@ import java.util.Queue;
* ConcurrentModificationException}, and may proceed concurrently with
* other operations.
*
* <p>Beware that, unlike in most collections, the {@code size}
* method is <em>NOT</em> a constant-time operation. Because of the
* <p>Beware that, unlike in most collections, the {@code size} method
* is <em>NOT</em> a constant-time operation. Because of the
* 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>
* methods of the {@link Deque} and {@link Iterator} interfaces.
......
......@@ -72,7 +72,14 @@ import java.util.Queue;
* <p>Beware that, unlike in most collections, the {@code size} method
* is <em>NOT</em> a constant-time operation. Because of the
* 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>
* methods of the {@link Queue} and {@link Iterator} interfaces.
......
......@@ -66,12 +66,13 @@ import java.util.concurrent.atomic.*;
* <p>Beware that, unlike in most collections, the <tt>size</tt>
* method is <em>not</em> a constant-time operation. Because of the
* asynchronous nature of these maps, determining the current number
* of elements requires a traversal of the elements. Additionally,
* the bulk operations <tt>putAll</tt>, <tt>equals</tt>, and
* <tt>clear</tt> are <em>not</em> guaranteed to be performed
* atomically. For example, an iterator operating concurrently with a
* <tt>putAll</tt> operation might view only some of the added
* 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 <tt>putAll</tt>, <tt>equals</tt>,
* <tt>toArray</tt>, <tt>containsValue</tt>, and <tt>clear</tt> are
* <em>not</em> guaranteed to be performed atomically. For example, an
* 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
* <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
* 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
* @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
*/
public NavigableSet<K> keySet() {
public NavigableSet<K> keySet() {
KeySet ks = keySet;
return (ks != null) ? ks : (keySet = new KeySet(this));
}
......
......@@ -58,12 +58,14 @@ import sun.misc.Unsafe;
* <p>Beware that, unlike in most collections, the <tt>size</tt>
* method is <em>not</em> a constant-time operation. Because of the
* asynchronous nature of these sets, determining the current number
* of elements requires a traversal of the elements. Additionally, the
* bulk operations <tt>addAll</tt>, <tt>removeAll</tt>,
* <tt>retainAll</tt>, and <tt>containsAll</tt> are <em>not</em>
* guaranteed to be performed atomically. For example, an iterator
* operating concurrently with an <tt>addAll</tt> operation might view
* only some of the added 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 <tt>addAll</tt>,
* <tt>removeAll</tt>, <tt>retainAll</tt>, <tt>containsAll</tt>,
* <tt>equals</tt>, and <tt>toArray</tt> are <em>not</em> guaranteed
* 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
* <em>optional</em> methods of the {@link Set} and {@link Iterator}
......
......@@ -51,10 +51,17 @@ import java.util.concurrent.locks.LockSupport;
* producer. The <em>tail</em> of the queue is that element that has
* been on the queue the shortest time for some producer.
*
* <p>Beware that, unlike in most collections, the {@code size}
* method is <em>NOT</em> a constant-time operation. Because of the
* <p>Beware that, unlike in most collections, the {@code size} method
* is <em>NOT</em> a constant-time operation. Because of the
* 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> methods of the {@link Collection} and {@link
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册