mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8231592: Clarify that ConcurrentHashMap compute methods mapping functions execute at most once
Reviewed-by: martin
This commit is contained in:
parent
b56749537d
commit
dc7d30d08e
10 changed files with 109 additions and 30 deletions
|
@ -1667,11 +1667,14 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
|
|||
* If the specified key is not already associated with a value,
|
||||
* attempts to compute its value using the given mapping function
|
||||
* and enters it into this map unless {@code null}. The entire
|
||||
* method invocation is performed atomically, so the function is
|
||||
* applied at most once per key. Some attempted update operations
|
||||
* on this map by other threads may be blocked while computation
|
||||
* is in progress, so the computation should be short and simple,
|
||||
* and must not attempt to update any other mappings of this map.
|
||||
* method invocation is performed atomically. The supplied
|
||||
* function is invoked exactly once per invocation of this method
|
||||
* if the key is absent, else not at all. Some attempted update
|
||||
* operations on this map by other threads may be blocked while
|
||||
* computation is in progress, so the computation should be short
|
||||
* and simple.
|
||||
*
|
||||
* <p>The mapping function must not modify this map during computation.
|
||||
*
|
||||
* @param key key with which the specified value is to be associated
|
||||
* @param mappingFunction the function to compute a value
|
||||
|
@ -1778,10 +1781,13 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
|
|||
* If the value for the specified key is present, attempts to
|
||||
* compute a new mapping given the key and its current mapped
|
||||
* value. The entire method invocation is performed atomically.
|
||||
* Some attempted update operations on this map by other threads
|
||||
* may be blocked while computation is in progress, so the
|
||||
* computation should be short and simple, and must not attempt to
|
||||
* update any other mappings of this map.
|
||||
* The supplied function is invoked exactly once per invocation of
|
||||
* this method if the key is present, else not at all. Some
|
||||
* attempted update operations on this map by other threads may be
|
||||
* blocked while computation is in progress, so the computation
|
||||
* should be short and simple.
|
||||
*
|
||||
* <p>The remapping function must not modify this map during computation.
|
||||
*
|
||||
* @param key key with which a value may be associated
|
||||
* @param remappingFunction the function to compute a value
|
||||
|
@ -1870,10 +1876,12 @@ public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
|
|||
* Attempts to compute a mapping for the specified key and its
|
||||
* current mapped value (or {@code null} if there is no current
|
||||
* mapping). The entire method invocation is performed atomically.
|
||||
* Some attempted update operations on this map by other threads
|
||||
* may be blocked while computation is in progress, so the
|
||||
* computation should be short and simple, and must not attempt to
|
||||
* update any other mappings of this Map.
|
||||
* The supplied function is invoked exactly once per invocation of
|
||||
* this method. Some attempted update operations on this map by
|
||||
* other threads may be blocked while computation is in progress,
|
||||
* so the computation should be short and simple.
|
||||
*
|
||||
* <p>The remapping function must not modify this map during computation.
|
||||
*
|
||||
* @param key key with which the specified value is to be associated
|
||||
* @param remappingFunction the function to compute a value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue