changeset 13128:e2896d563f7b

8143073: Improve documentation for ConcurrentHashMap serialized form Reviewed-by: martin, psandoz, chegar, shade, plevart
author dl
date Wed, 25 Nov 2015 18:18:28 -0800
parents e1a21828acc1
children 64e1f7283f2b
files src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java
diffstat 1 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java	Wed Nov 25 18:12:38 2015 -0800
+++ b/src/java.base/share/classes/java/util/concurrent/ConcurrentHashMap.java	Wed Nov 25 18:18:28 2015 -0800
@@ -596,7 +596,16 @@
     /** Number of CPUS, to place bounds on some sizings */
     static final int NCPU = Runtime.getRuntime().availableProcessors();
 
-    /** For serialization compatibility. */
+    /**
+     * Serialized pseudo-fields, provided only for jdk7 compatibility.
+     * @serialField segments Segment[]
+     *   The segments, each of which is a specialized hash table.
+     * @serialField segmentMask int
+     *   Mask value for indexing into segments. The upper bits of a
+     *   key's hash code are used to choose the segment.
+     * @serialField segmentShift int
+     *   Shift value for indexing within segments.
+     */
     private static final ObjectStreamField[] serialPersistentFields = {
         new ObjectStreamField("segments", Segment[].class),
         new ObjectStreamField("segmentMask", Integer.TYPE),
@@ -1382,8 +1391,8 @@
      * @param s the stream
      * @throws java.io.IOException if an I/O error occurs
      * @serialData
-     * the key (Object) and value (Object)
-     * for each key-value mapping, followed by a null pair.
+     * the serialized fields, followed by the key (Object) and value
+     * (Object) for each key-value mapping, followed by a null pair.
      * The key-value mappings are emitted in no particular order.
      */
     private void writeObject(java.io.ObjectOutputStream s)
@@ -1419,7 +1428,6 @@
         }
         s.writeObject(null);
         s.writeObject(null);
-        segments = null; // throw away
     }
 
     /**