{"id":88882,"date":"2026-08-01T21:40:31","date_gmt":"2026-08-01T13:40:31","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/88882.html"},"modified":"2026-08-01T21:40:31","modified_gmt":"2026-08-01T13:40:31","slug":"concurrenthashmap-%e6%b7%b1%e5%ba%a6%e8%a7%a3%e6%9e%90%ef%bc%9a%e4%bb%8e%e5%88%86%e6%ae%b5%e9%94%81%e5%88%b0-cas-%e7%9a%84%e8%bf%9b%e5%8c%96%e4%b9%8b%e8%b7%af","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/88882.html","title":{"rendered":"ConcurrentHashMap \u6df1\u5ea6\u89e3\u6790\uff1a\u4ece\u5206\u6bb5\u9501\u5230 CAS \u7684\u8fdb\u5316\u4e4b\u8def"},"content":{"rendered":"<h3>\u4e00\u3001\u5f15\u8a00&#xff1a;HashMap \u7684\u7ebf\u7a0b\u5b89\u5168\u56f0\u5883<\/h3>\n<p>HashMap \u662f Java \u4e2d\u6700\u5e38\u7528\u7684\u5bb9\u5668\u4e4b\u4e00&#xff0c;\u4f46\u5b83\u6709\u4e00\u4e2a\u81f4\u547d\u7f3a\u9677\u2014\u2014\u7ebf\u7a0b\u4e0d\u5b89\u5168\u3002\u5728\u591a\u7ebf\u7a0b\u73af\u5883\u4e0b&#xff0c;HashMap \u5728\u6269\u5bb9\u65f6\u53ef\u80fd\u5f62\u6210\u73af\u5f62\u94fe\u8868&#xff0c;\u5bfc\u81f4 get() \u64cd\u4f5c\u9677\u5165\u6b7b\u5faa\u73af&#xff0c;CPU \u98d9\u5347\u5230 100%\u3002<\/p>\n<p>\u90a3\u7528 Hashtable \u5462&#xff1f;\u5b83\u6240\u6709\u65b9\u6cd5\u90fd\u52a0\u4e86 synchronized&#xff0c;\u76f8\u5f53\u4e8e\u7ed9\u6574\u5f20\u8868\u4e0a\u4e86\u4e00\u628a\u5927\u9501&#xff0c;\u540c\u4e00\u65f6\u523b\u53ea\u5141\u8bb8\u4e00\u4e2a\u7ebf\u7a0b\u64cd\u4f5c&#xff0c;\u5e76\u53d1\u6027\u80fd\u6781\u5dee\u3002<\/p>\n<p>\u4e8e\u662f&#xff0c;ConcurrentHashMap \u5e94\u8fd0\u800c\u751f\u3002\u5b83\u65e2\u4fdd\u8bc1\u4e86\u7ebf\u7a0b\u5b89\u5168&#xff0c;\u53c8\u8ffd\u6c42\u6781\u9ad8\u7684\u5e76\u53d1\u6027\u80fd&#xff0c;\u662f Java \u5e76\u53d1\u5bb9\u5668\u4e2d\u6700\u95ea\u8000\u7684\u660e\u661f\u3002<\/p>\n<p>\u6838\u5fc3\u5b9a\u4f4d&#xff1a;ConcurrentHashMap \u662f\u4e00\u4e2a\u7ebf\u7a0b\u5b89\u5168\u7684\u54c8\u5e0c\u8868&#xff0c;\u8bbe\u8ba1\u76ee\u6807\u662f\u5728\u6700\u5c0f\u5316\u66f4\u65b0\u64cd\u4f5c\u5bf9\u54c8\u5e0c\u8868\u5360\u7528\u7684\u540c\u65f6&#xff0c;\u4fdd\u6301\u4e0e HashMap \u76f8\u5f53\u7684\u7a7a\u95f4\u6d88\u8017&#xff0c;\u5e76\u652f\u6301\u591a\u7ebf\u7a0b\u9ad8\u6548\u5e76\u53d1\u8bbf\u95ee\u3002<\/p>\n<p>\u4ece Java 7 \u5230 Java 8&#xff0c;ConcurrentHashMap \u7ecf\u5386\u4e86\u4e00\u6b21\u5f7b\u5e95\u7684\u91cd\u5199&#xff0c;\u4ee3\u7801\u91cf\u4ece 1000 \u591a\u884c\u66b4\u6da8\u5230 6000 \u591a\u884c\u3002\u4e0b\u9762\u6211\u4eec\u4ece JDK 8 \u7684\u89c6\u89d2&#xff0c;\u6df1\u5165\u6e90\u7801\u4e00\u63a2\u7a76\u7adf\u3002<\/p>\n<h3>\u4e8c\u3001JDK 7 vs JDK 8&#xff1a;\u67b6\u6784\u7684\u5168\u9762\u8fdb\u5316<\/h3>\n<h4>2.1 JDK 7&#xff1a;\u5206\u6bb5\u9501&#xff08;Segment Lock&#xff09;<\/h4>\n<p>Java 7 \u4e2d\u7684 ConcurrentHashMap \u91c7\u7528\u4e86\u5206\u6bb5\u9501\u6280\u672f&#xff1a;\u5c06\u6570\u636e\u5206\u6210\u591a\u4e2a Segment&#xff0c;\u6bcf\u4e2a Segment \u72ec\u7acb\u52a0\u9501\u3002<\/p>\n<ul>\n<li>\n<p>Segment \u7ee7\u627f\u81ea ReentrantLock&#xff0c;\u6bcf\u4e2a Segment \u662f\u4e00\u628a\u72ec\u7acb\u7684\u9501<\/p>\n<\/li>\n<li>\n<p>\u9ed8\u8ba4 16 \u4e2a Segment&#xff0c;\u7406\u8bba\u4e0a\u652f\u6301 16 \u4e2a\u7ebf\u7a0b\u5e76\u53d1\u5199\u5165<\/p>\n<\/li>\n<li>\n<p>\u9501\u7684\u7c92\u5ea6\u662f\u6574\u4e2a Segment&#xff0c;\u4e00\u4e2a Segment \u5185\u7684\u6240\u6709\u64cd\u4f5c\u4e92\u65a5<\/p>\n<\/li>\n<\/ul>\n<h4>2.2 JDK 8&#xff1a;CAS &#043; synchronized<\/h4>\n<p>Java 8 \u5f7b\u5e95\u6452\u5f03\u4e86 Segment \u7684\u8bbe\u8ba1&#xff0c;\u91c7\u7528\u4e86\u4e0e HashMap \u76f8\u540c\u7684\u6570\u636e\u7ed3\u6784\u2014\u2014\u6570\u7ec4 &#043; \u94fe\u8868 &#043; \u7ea2\u9ed1\u6811&#xff0c;\u5e76\u4f7f\u7528 CAS &#043; synchronized \u4fdd\u8bc1\u7ebf\u7a0b\u5b89\u5168\u3002<\/p>\n<table>\n<tbody>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u5bf9\u6bd4\u7ef4\u5ea6<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>JDK 7<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>JDK 8<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u6570\u636e\u7ed3\u6784<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>Segment\u6570\u7ec4 &#043; HashEntry\u6570\u7ec4 &#043; \u94fe\u8868<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>Node\u6570\u7ec4 &#043; \u94fe\u8868 &#043; \u7ea2\u9ed1\u6811<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u9501\u673a\u5236<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>ReentrantLock&#xff08;\u5206\u6bb5\u9501&#xff09;<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>CAS &#043; synchronized&#xff08;\u9501\u5934\u8282\u70b9&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u9501\u7c92\u5ea6<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u6574\u4e2a Segment<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u5355\u4e2a\u6876&#xff08;\u94fe\u8868\/\u6811\u7684\u9996\u8282\u70b9&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u5e76\u53d1\u5ea6<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u56fa\u5b9a&#xff08;\u9ed8\u8ba416&#xff09;<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u52a8\u6001&#xff08;\u6570\u7ec4\u957f\u5ea6&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u6269\u5bb9\u53c2\u4e0e<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u5355\u7ebf\u7a0b\u6269\u5bb9<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u591a\u7ebf\u7a0b\u534f\u52a9\u6269\u5bb9<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>JDK 8 \u7684\u6838\u5fc3\u4f18\u52bf&#xff1a;\u9501\u7c92\u5ea6\u4ece Segment \u7f29\u5c0f\u5230\u5355\u4e2a\u6876\u8282\u70b9&#xff0c;\u53ea\u8981 hash \u4e0d\u51b2\u7a81&#xff0c;\u4e0d\u540c\u6876\u7684\u64cd\u4f5c\u53ef\u4ee5\u5b8c\u5168\u5e76\u884c\u3002<\/p>\n<h3>\u4e09\u3001\u6838\u5fc3\u6570\u636e\u7ed3\u6784\u4e0e\u6210\u5458\u53d8\u91cf<\/h3>\n<h4>3.1 Node\u2014\u2014\u57fa\u672c\u5b58\u50a8\u8282\u70b9<\/h4>\n<p>Node \u662f ConcurrentHashMap \u4e2d\u6700\u57fa\u7840\u7684\u5b58\u50a8\u5355\u5143&#xff1a;<\/p>\n<p>static class Node&lt;K,V&gt; implements Map.Entry&lt;K,V&gt; {<br \/>\n    final int hash;<br \/>\n    final K key;<br \/>\n    volatile V val;          \/\/ volatile \u4fdd\u8bc1\u53ef\u89c1\u6027<br \/>\n    volatile Node&lt;K,V&gt; next; \/\/ volatile \u4fdd\u8bc1\u53ef\u89c1\u6027<\/p>\n<p>    Node(int hash, K key, V val, Node&lt;K,V&gt; next) {<br \/>\n        this.hash &#061; hash;<br \/>\n        this.key &#061; key;<br \/>\n        this.val &#061; val;<br \/>\n        this.next &#061; next;<br \/>\n    }<br \/>\n}<\/p>\n<p>\u5173\u952e\u8bbe\u8ba1&#xff1a;val \u548c next \u90fd\u4f7f\u7528\u4e86 volatile \u4fee\u9970&#xff0c;\u786e\u4fdd\u4e00\u4e2a\u7ebf\u7a0b\u5bf9\u8282\u70b9\u7684\u4fee\u6539\u5bf9\u5176\u4ed6\u7ebf\u7a0b\u7acb\u5373\u53ef\u89c1\u3002<\/p>\n<h4>3.2 TreeNode\u2014\u2014\u7ea2\u9ed1\u6811\u8282\u70b9<\/h4>\n<p>\u5f53\u94fe\u8868\u957f\u5ea6\u8d85\u8fc7\u9608\u503c\u65f6&#xff0c;\u94fe\u8868\u4f1a\u8f6c\u6362\u4e3a\u7ea2\u9ed1\u6811\u3002TreeNode \u7ee7\u627f\u81ea Node&#xff0c;\u589e\u52a0\u4e86\u7ea2\u9ed1\u6811\u6240\u9700\u7684\u6307\u9488&#xff1a;<\/p>\n<p>static final class TreeNode&lt;K,V&gt; extends Node&lt;K,V&gt; {<br \/>\n    TreeNode&lt;K,V&gt; parent;  \/\/ \u7236\u8282\u70b9<br \/>\n    TreeNode&lt;K,V&gt; left;    \/\/ \u5de6\u5b50\u8282\u70b9<br \/>\n    TreeNode&lt;K,V&gt; right;   \/\/ \u53f3\u5b50\u8282\u70b9<br \/>\n    TreeNode&lt;K,V&gt; prev;    \/\/ \u524d\u9a71\u8282\u70b9&#xff08;\u7528\u4e8e\u7ef4\u6301\u53cc\u5411\u94fe\u8868&#xff09;<br \/>\n    boolean red;           \/\/ \u7ea2\/\u9ed1\u989c\u8272\u6807\u8bb0<br \/>\n}<\/p>\n<h4>3.3 TreeBin\u2014\u2014\u7ea2\u9ed1\u6811\u4ee3\u7406<\/h4>\n<p>\u6ce8\u610f&#xff1a;\u6876\u4f4d\u4e2d\u5b58\u50a8\u7684\u4e0d\u662f TreeNode \u5bf9\u8c61&#xff0c;\u800c\u662f TreeBin \u5bf9\u8c61\u3002TreeBin \u662f\u7ea2\u9ed1\u6811\u7684\u4ee3\u7406\u5bb9\u5668&#xff0c;\u5185\u90e8\u7ef4\u62a4\u7740\u7ea2\u9ed1\u6811\u7684\u6839\u8282\u70b9 root \u548c\u53cc\u5411\u94fe\u8868\u7684\u5934\u8282\u70b9 first\u3002<\/p>\n<h4>3.4 ForwardingNode\u2014\u2014\u6269\u5bb9\u6807\u8bb0\u8282\u70b9<\/h4>\n<p>\u5f53\u67d0\u4e2a\u6876\u7684\u6570\u636e\u8fc1\u79fb\u5b8c\u6210\u540e&#xff0c;\u8be5\u6876\u4f4d\u4f1a\u88ab\u8bbe\u7f6e\u4e3a ForwardingNode&#xff08;\u7b80\u79f0 FWD \u8282\u70b9&#xff09;&#xff0c;\u5176 hash \u503c\u4e3a MOVED&#xff08;-1&#xff09;\u3002\u540e\u7eed\u5176\u4ed6\u7ebf\u7a0b\u770b\u5230\u8fd9\u4e2a\u6807\u8bb0&#xff0c;\u5c31\u77e5\u9053\u8be5\u6876\u6b63\u5728\u6269\u5bb9\u6216\u5df2\u8fc1\u79fb\u5b8c\u6210\u3002<\/p>\n<h4>3.5 \u6838\u5fc3\u6210\u5458\u53d8\u91cf<\/h4>\n<p>\/\/ \u5b58\u50a8\u6570\u636e\u7684\u6570\u7ec4&#xff0c;volatile \u4fdd\u8bc1\u53ef\u89c1\u6027<br \/>\ntransient volatile Node&lt;K,V&gt;[] table;<\/p>\n<p>\/\/ \u6269\u5bb9\u65f6\u4f7f\u7528\u7684\u65b0\u6570\u7ec4&#xff08;\u4ec5\u5728\u6269\u5bb9\u671f\u95f4\u975e\u7a7a&#xff09;<br \/>\nprivate transient volatile Node&lt;K,V&gt;[] nextTable;<\/p>\n<p>\/\/ \u6838\u5fc3\u63a7\u5236\u5b57\u6bb5&#xff1a;\u63a7\u5236\u521d\u59cb\u5316\u548c\u6269\u5bb9<br \/>\nprivate transient volatile int sizeCtl;<\/p>\n<p>\/\/ \u9ed8\u8ba4\u521d\u59cb\u5bb9\u91cf 16<br \/>\nprivate static final int DEFAULT_CAPACITY &#061; 16;<\/p>\n<p>\/\/ \u6700\u5927\u5bb9\u91cf 2^30<br \/>\nprivate static final int MAXIMUM_CAPACITY &#061; 1 &lt;&lt; 30;<\/p>\n<p>\/\/ \u8d1f\u8f7d\u56e0\u5b50 0.75&#xff08;\u56fa\u5b9a&#xff0c;\u4e0d\u53ef\u4fee\u6539&#xff09;<br \/>\nprivate static final float LOAD_FACTOR &#061; 0.75f;<\/p>\n<p>\/\/ \u94fe\u8868\u8f6c\u7ea2\u9ed1\u6811\u9608\u503c&#xff1a;8<br \/>\nstatic final int TREEIFY_THRESHOLD &#061; 8;<\/p>\n<p>\/\/ \u7ea2\u9ed1\u6811\u8f6c\u94fe\u8868\u9608\u503c&#xff1a;6<br \/>\nstatic final int UNTREEIFY_THRESHOLD &#061; 6;<\/p>\n<p>\/\/ \u8f6c\u7ea2\u9ed1\u6811\u7684\u6700\u5c0f\u6570\u7ec4\u5bb9\u91cf&#xff1a;64&#xff08;\u5c0f\u4e8e\u6b64\u503c\u4f18\u5148\u6269\u5bb9&#xff09;<br \/>\nstatic final int MIN_TREEIFY_CAPACITY &#061; 64;<\/p>\n<h4>3.6 sizeCtl\u2014\u2014\u6700\u6838\u5fc3\u7684\u63a7\u5236\u5b57\u6bb5<\/h4>\n<p>sizeCtl \u662f ConcurrentHashMap \u4e2d\u51fa\u955c\u7387\u6700\u9ad8\u7684\u5b57\u6bb5&#xff0c;\u5b83\u7684\u503c\u5728\u4e0d\u540c\u9636\u6bb5\u4ee3\u8868\u4e0d\u540c\u542b\u4e49&#xff1a;<\/p>\n<table>\n<tbody>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>sizeCtl \u503c<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u542b\u4e49<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>0<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u9ed8\u8ba4\u503c&#xff0c;\u5c1a\u672a\u521d\u59cb\u5316<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>-1<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u6b63\u5728\u521d\u59cb\u5316 table<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>&lt; -1<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u6b63\u5728\u6269\u5bb9&#xff0c;\u4f4e 16 \u4f4d\u8868\u793a\u53c2\u4e0e\u6269\u5bb9\u7684\u7ebf\u7a0b\u6570&#xff08;\u5982 -N \u8868\u793a\u6709 N-1 \u4e2a\u7ebf\u7a0b\u53c2\u4e0e&#xff09;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>&gt; 0<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u521d\u59cb\u5316\u5b8c\u6210\u540e\u7684\u6269\u5bb9\u9608\u503c&#xff08;\u5bb9\u91cf \u00d7 0.75&#xff09;<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u56db\u3001\u6784\u9020\u65b9\u6cd5&#xff1a;\u5ef6\u8fdf\u521d\u59cb\u5316<\/h3>\n<p>ConcurrentHashMap \u91c7\u7528\u4e86\u5ef6\u8fdf\u521d\u59cb\u5316\u7b56\u7565\u2014\u2014\u6784\u9020\u65b9\u6cd5\u53ea\u8ba1\u7b97\u5bb9\u91cf&#xff0c;\u5e76\u4e0d\u771f\u6b63\u521b\u5efa table \u6570\u7ec4\u3002<\/p>\n<p>\/\/ \u65e0\u53c2\u6784\u9020&#xff1a;\u4ec0\u4e48\u4e5f\u4e0d\u505a<br \/>\npublic ConcurrentHashMap() { }<\/p>\n<p>\/\/ \u6307\u5b9a\u521d\u59cb\u5bb9\u91cf\u7684\u6784\u9020\u65b9\u6cd5<br \/>\npublic ConcurrentHashMap(int initialCapacity) {<br \/>\n    if (initialCapacity &lt; 0)<br \/>\n        throw new IllegalArgumentException();<br \/>\n    \/\/ \u8ba1\u7b97\u5927\u4e8e 1.5 * initialCapacity &#043; 1 \u7684\u6700\u5c0f 2 \u7684\u5e42<br \/>\n    int cap &#061; tableSizeFor(initialCapacity &#043; (initialCapacity &gt;&gt;&gt; 1) &#043; 1);<br \/>\n    this.sizeCtl &#061; cap;  \/\/ \u53ea\u8bbe\u7f6e sizeCtl&#xff0c;\u4e0d\u521b\u5efa table<br \/>\n}<\/p>\n<p>\u5ef6\u8fdf\u521d\u59cb\u5316\u7684\u597d\u5904&#xff1a;\u53ea\u6709\u5728\u7b2c\u4e00\u6b21 put \u65f6\u624d\u771f\u6b63\u521b\u5efa\u6570\u7ec4&#xff0c;\u907f\u514d\u4e86\u4e0d\u5fc5\u8981\u7684\u5185\u5b58\u5360\u7528\u3002<\/p>\n<p>tableSizeFor \u65b9\u6cd5\u786e\u4fdd\u5bb9\u91cf\u59cb\u7ec8\u662f 2 \u7684\u5e42&#xff0c;\u8fd9\u662f\u4e3a\u4e86\u540e\u7eed\u4f7f\u7528\u4f4d\u8fd0\u7b97&#xff08;(n &#8211; 1) &amp; hash&#xff09;\u66ff\u4ee3\u53d6\u6a21\u8fd0\u7b97&#xff0c;\u63d0\u5347\u6027\u80fd\u3002<\/p>\n<p>\u6ce8\u610f&#xff1a;loadFactor \u867d\u7136\u5728\u6784\u9020\u65b9\u6cd5\u4e2d\u4f5c\u4e3a\u53c2\u6570\u4f20\u5165&#xff0c;\u4f46\u8ba1\u7b97\u5b8c size \u540e\u5e76\u672a\u88ab\u4fdd\u5b58\u4e3a\u6210\u5458\u53d8\u91cf&#xff0c;\u540e\u7eed\u6269\u5bb9\u9608\u503c\u8ba1\u7b97\u56fa\u5b9a\u4f7f\u7528 0.75\u3002<\/p>\n<h3>\u4e94\u3001put \u65b9\u6cd5&#xff1a;\u7ebf\u7a0b\u5b89\u5168\u7684\u6838\u5fc3<\/h3>\n<p>put \u65b9\u6cd5\u662f ConcurrentHashMap \u6700\u590d\u6742\u7684\u90e8\u5206&#xff0c;\u6d89\u53ca\u521d\u59cb\u5316\u3001CAS \u63d2\u5165\u3001\u9501\u6269\u5bb9\u3001\u94fe\u8868\/\u6811\u64cd\u4f5c\u7b49\u591a\u4e2a\u73af\u8282\u3002<\/p>\n<h4>5.1 \u5165\u53e3\u4e0e hash \u8ba1\u7b97<\/h4>\n<p>public V put(K key, V value) {<br \/>\n    return putVal(key, value, false);<br \/>\n}<\/p>\n<p>final V putVal(K key, V value, boolean onlyIfAbsent) {<br \/>\n    \/\/ key \u548c value \u90fd\u4e0d\u80fd\u4e3a null<br \/>\n    if (key &#061;&#061; null || value &#061;&#061; null) throw new NullPointerException();<\/p>\n<p>    \/\/ spread&#xff1a;\u8ba9\u9ad8\u4f4d\u53c2\u4e0e\u5bfb\u5740&#xff0c;\u4f7f hash \u66f4\u5206\u6563<br \/>\n    int hash &#061; spread(key.hashCode());<br \/>\n    int binCount &#061; 0;  \/\/ \u8bb0\u5f55\u6876\u4e2d\u5143\u7d20\u4e2a\u6570&#xff0c;\u7528\u4e8e\u5224\u65ad\u662f\u5426\u6811\u5316<\/p>\n<p>    \/\/ \u81ea\u65cb&#xff08;\u65e0\u9650\u5faa\u73af&#xff09;&#xff0c;\u76f4\u5230\u64cd\u4f5c\u6210\u529f<br \/>\n    for (Node&lt;K,V&gt;[] tab &#061; table;;) {<br \/>\n        Node&lt;K,V&gt; f; int n, i, fh;<br \/>\n        \/\/ &#8230; \u56db\u79cd\u60c5\u51b5\u5904\u7406<br \/>\n    }<br \/>\n}<\/p>\n<p>spread \u65b9\u6cd5\u5c06 key.hashCode() \u7684\u9ad8\u4f4d\u4e0e\u4f4e\u4f4d\u6df7\u5408&#xff0c;\u51cf\u5c11 hash \u51b2\u7a81&#xff1a;<\/p>\n<p>static final int spread(int h) {<br \/>\n    return (h ^ (h &gt;&gt;&gt; 16)) &amp; HASH_BITS;<br \/>\n}<\/p>\n<h4>5.2 \u56db\u79cd\u60c5\u51b5\u5904\u7406<\/h4>\n<p>putVal \u7684\u6838\u5fc3\u662f\u4e00\u4e2a\u81ea\u65cb\u5faa\u73af&#xff0c;\u5904\u7406\u56db\u79cd\u4e0d\u540c\u7684\u60c5\u51b5&#xff1a;<\/p>\n<h5>Case 1&#xff1a;table \u672a\u521d\u59cb\u5316<\/h5>\n<p>if (tab &#061;&#061; null || (n &#061; tab.length) &#061;&#061; 0)<br \/>\n    tab &#061; initTable();  \/\/ \u521d\u59cb\u5316 table<\/p>\n<p>initTable() \u901a\u8fc7 CAS \u63a7\u5236 sizeCtl&#xff0c;\u786e\u4fdd\u53ea\u6709\u4e00\u4e2a\u7ebf\u7a0b\u6267\u884c\u521d\u59cb\u5316&#xff1a;<\/p>\n<p>private final Node&lt;K,V&gt;[] initTable() {<br \/>\n    Node&lt;K,V&gt;[] tab; int sc;<br \/>\n    while ((tab &#061; table) &#061;&#061; null || tab.length &#061;&#061; 0) {<br \/>\n        if ((sc &#061; sizeCtl) &lt; 0)  \/\/ \u5176\u4ed6\u7ebf\u7a0b\u6b63\u5728\u521d\u59cb\u5316<br \/>\n            Thread.yield();<br \/>\n        else if (U.compareAndSetInt(this, SIZECTL, sc, -1)) {<br \/>\n            \/\/ CAS \u5c06 sizeCtl \u8bbe\u4e3a -1&#xff0c;\u5f53\u524d\u7ebf\u7a0b\u83b7\u5f97\u521d\u59cb\u5316\u6743<br \/>\n            try {<br \/>\n                if ((tab &#061; table) &#061;&#061; null || tab.length &#061;&#061; 0) {<br \/>\n                    int n &#061; (sc &gt; 0) ? sc : DEFAULT_CAPACITY;<br \/>\n                    Node&lt;K,V&gt;[] nt &#061; (Node&lt;K,V&gt;[])new Node&lt;?,?&gt;[n];<br \/>\n                    table &#061; tab &#061; nt;<br \/>\n                    sc &#061; n &#8211; (n &gt;&gt;&gt; 2);  \/\/ 0.75 * n<br \/>\n                }<br \/>\n            } finally {<br \/>\n                sizeCtl &#061; sc;  \/\/ \u8bbe\u7f6e\u6269\u5bb9\u9608\u503c<br \/>\n            }<br \/>\n            break;<br \/>\n        }<br \/>\n    }<br \/>\n    return tab;<br \/>\n}<\/p>\n<h5>Case 2&#xff1a;\u6876\u4f4d\u4e3a\u7a7a&#xff08;\u65e0 hash \u51b2\u7a81&#xff09;<\/h5>\n<p>else if ((f &#061; tabAt(tab, i &#061; (n &#8211; 1) &amp; hash)) &#061;&#061; null) {<br \/>\n    \/\/ \u4f7f\u7528 CAS \u5c06\u65b0\u8282\u70b9\u653e\u5165\u7a7a\u6876\u4f4d<br \/>\n    if (casTabAt(tab, i, null, new Node&lt;K,V&gt;(hash, key, value, null)))<br \/>\n        break;  \/\/ CAS \u6210\u529f&#xff0c;\u8df3\u51fa\u5faa\u73af<br \/>\n}<\/p>\n<p>\u8fd9\u91cc\u4f7f\u7528 CAS \u65e0\u9501\u64cd\u4f5c&#xff0c;\u4e0d\u9700\u8981\u52a0\u9501&#xff0c;\u662f\u6700\u9ad8\u6548\u7684\u63d2\u5165\u573a\u666f\u3002<\/p>\n<h5>Case 3&#xff1a;\u6876\u4f4d\u6b63\u5728\u6269\u5bb9&#xff08;FWD \u8282\u70b9&#xff09;<\/h5>\n<p>else if ((fh &#061; f.hash) &#061;&#061; MOVED)<br \/>\n    tab &#061; helpTransfer(tab, f);  \/\/ \u5f53\u524d\u7ebf\u7a0b\u534f\u52a9\u6269\u5bb9<\/p>\n<p>\u5982\u679c\u6876\u4f4d\u7684\u5934\u8282\u70b9\u662f ForwardingNode&#xff08;hash &#061;&#061; MOVED&#xff09;&#xff0c;\u8bf4\u660e\u8be5\u6876\u6b63\u5728\u6269\u5bb9\u8fc1\u79fb&#xff0c;\u5f53\u524d\u7ebf\u7a0b\u4f1a\u534f\u52a9\u6269\u5bb9\u3002<\/p>\n<h5>Case 4&#xff1a;\u6b63\u5e38\u63d2\u5165&#xff08;\u94fe\u8868\u6216\u7ea2\u9ed1\u6811&#xff09;<\/h5>\n<p>else {<br \/>\n    V oldVal &#061; null;<br \/>\n    synchronized (f) {  \/\/ \u9501\u4f4f\u5934\u8282\u70b9<br \/>\n        if (tabAt(tab, i) &#061;&#061; f) {  \/\/ \u53cc\u91cd\u68c0\u67e5<br \/>\n            if (fh &gt;&#061; 0) {  \/\/ \u666e\u901a\u94fe\u8868\u8282\u70b9<br \/>\n                binCount &#061; 1;<br \/>\n                for (Node&lt;K,V&gt; e &#061; f;; &#043;&#043;binCount) {<br \/>\n                    K ek;<br \/>\n                    if (e.hash &#061;&#061; hash &amp;&amp;<br \/>\n                        ((ek &#061; e.key) &#061;&#061; key || (ek !&#061; null &amp;&amp; key.equals(ek)))) {<br \/>\n                        oldVal &#061; e.val;<br \/>\n                        if (!onlyIfAbsent) e.val &#061; value;<br \/>\n                        break;<br \/>\n                    }<br \/>\n                    Node&lt;K,V&gt; pred &#061; e;<br \/>\n                    if ((e &#061; e.next) &#061;&#061; null) {<br \/>\n                        pred.next &#061; new Node&lt;K,V&gt;(hash, key, value, null);<br \/>\n                        break;<br \/>\n                    }<br \/>\n                }<br \/>\n            } else if (f instanceof TreeBin) {  \/\/ \u7ea2\u9ed1\u6811\u8282\u70b9<br \/>\n                Node&lt;K,V&gt; p;<br \/>\n                binCount &#061; 2;<br \/>\n                if ((p &#061; ((TreeBin&lt;K,V&gt;)f).putTreeVal(hash, key, value)) !&#061; null) {<br \/>\n                    oldVal &#061; p.val;<br \/>\n                    if (!onlyIfAbsent) p.val &#061; value;<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n    }<br \/>\n    \/\/ \u5224\u65ad\u662f\u5426\u9700\u8981\u6811\u5316<br \/>\n    if (binCount !&#061; 0) {<br \/>\n        if (binCount &gt;&#061; TREEIFY_THRESHOLD)  \/\/ &gt;&#061; 8<br \/>\n            treeifyBin(tab, i);<br \/>\n        if (oldVal !&#061; null) return oldVal;<br \/>\n        break;<br \/>\n    }<br \/>\n}<\/p>\n<p>\u5173\u952e\u8bbe\u8ba1&#xff1a;\u4f7f\u7528 synchronized \u9501\u4f4f\u6876\u7684\u5934\u8282\u70b9&#xff08;f&#xff09;&#xff0c;\u800c\u4e0d\u662f\u9501\u6574\u5f20\u8868\u3002\u8fd9\u610f\u5473\u7740\u53ea\u6709\u64cd\u4f5c\u540c\u4e00\u4e2a\u6876\u7684\u7ebf\u7a0b\u624d\u4f1a\u7ade\u4e89\u9501&#xff0c;\u4e0d\u540c\u6876\u7684\u64cd\u4f5c\u5b8c\u5168\u5e76\u884c\u3002<\/p>\n<h4>5.3 addCount&#xff1a;\u5143\u7d20\u8ba1\u6570\u4e0e\u6269\u5bb9\u89e6\u53d1<\/h4>\n<p>\u63d2\u5165\u5b8c\u6210\u540e&#xff0c;\u8c03\u7528 addCount \u589e\u52a0\u5143\u7d20\u6570\u91cf&#xff0c;\u5e76\u68c0\u67e5\u662f\u5426\u9700\u8981\u6269\u5bb9&#xff1a;<\/p>\n<p>addCount(1L, binCount);<\/p>\n<p>addCount \u5185\u90e8\u4f1a\u5224\u65ad\u5f53\u524d\u5143\u7d20\u6570\u91cf\u662f\u5426\u8d85\u8fc7 sizeCtl&#xff08;\u6269\u5bb9\u9608\u503c&#xff09;&#xff0c;\u5982\u679c\u8d85\u8fc7\u5219\u89e6\u53d1 transfer \u6269\u5bb9\u3002<\/p>\n<h3>\u516d\u3001get \u65b9\u6cd5&#xff1a;\u65e0\u9501\u8bfb\u53d6\u7684\u79d8\u5bc6<\/h3>\n<p>get \u65b9\u6cd5\u662f ConcurrentHashMap \u6027\u80fd\u7684\u53c8\u4e00\u4f53\u73b0\u2014\u2014\u5168\u7a0b\u4e0d\u52a0\u9501\u3002<\/p>\n<p>public V get(Object key) {<br \/>\n    Node&lt;K,V&gt;[] tab; Node&lt;K,V&gt; e, p; int n, eh; K ek;<br \/>\n    int h &#061; spread(key.hashCode());<br \/>\n    if ((tab &#061; table) !&#061; null &amp;&amp; (n &#061; tab.length) &gt; 0 &amp;&amp;<br \/>\n        (e &#061; tabAt(tab, (n &#8211; 1) &amp; h)) !&#061; null) {<\/p>\n<p>        if ((eh &#061; e.hash) &#061;&#061; h) {<br \/>\n            \/\/ \u60c5\u51b51&#xff1a;\u9996\u8282\u70b9\u5c31\u662f\u76ee\u6807\u8282\u70b9<br \/>\n            if ((ek &#061; e.key) &#061;&#061; key || (ek !&#061; null &amp;&amp; key.equals(ek)))<br \/>\n                return e.val;<br \/>\n        }<br \/>\n        else if (eh &lt; 0) {<br \/>\n            \/\/ \u60c5\u51b52&#xff1a;hash &lt; 0&#xff0c;\u53ef\u80fd\u662f TreeBin \u6216 ForwardingNode<br \/>\n            \/\/ &#8211; \u5982\u679c\u662f ForwardingNode&#xff08;\u6269\u5bb9\u4e2d&#xff09;&#xff0c;\u53bb nextTable \u4e2d\u67e5\u627e<br \/>\n            \/\/ &#8211; \u5982\u679c\u662f TreeBin&#xff0c;\u904d\u5386\u7ea2\u9ed1\u6811<br \/>\n            return (p &#061; e.find(h, key)) !&#061; null ? p.val : null;<br \/>\n        }<br \/>\n        \/\/ \u60c5\u51b53&#xff1a;\u904d\u5386\u94fe\u8868<br \/>\n        while ((e &#061; e.next) !&#061; null) {<br \/>\n            if (e.hash &#061;&#061; h &amp;&amp;<br \/>\n                ((ek &#061; e.key) &#061;&#061; key || (ek !&#061; null &amp;&amp; key.equals(ek))))<br \/>\n                return e.val;<br \/>\n        }<br \/>\n    }<br \/>\n    return null;<br \/>\n}<\/p>\n<h4>\u4e3a\u4ec0\u4e48 get \u4e0d\u9700\u8981\u52a0\u9501&#xff1f;<\/h4>\n<li>\n<p>volatile \u4fdd\u8bc1\u53ef\u89c1\u6027&#xff1a;Node \u7684 val \u548c next \u90fd\u662f volatile \u7684&#xff0c;\u5199\u5165\u7684\u7ed3\u679c\u5bf9\u6240\u6709\u7ebf\u7a0b\u7acb\u5373\u53ef\u89c1<\/p>\n<\/li>\n<li>\n<p>table \u662f volatile \u7684&#xff1a;\u6570\u7ec4\u5f15\u7528\u672c\u8eab\u4fdd\u8bc1\u53ef\u89c1\u6027<\/p>\n<\/li>\n<li>\n<p>Node \u7684 hash \u548c key \u662f final \u7684&#xff1a;\u4e00\u65e6\u521b\u5efa\u4e0d\u53ef\u53d8<\/p>\n<\/li>\n<li>\n<p>\u6269\u5bb9\u65f6\u7684\u7279\u6b8a\u5904\u7406&#xff1a;\u901a\u8fc7 ForwardingNode.find() \u5230\u65b0\u8868\u67e5\u627e<\/p>\n<\/li>\n<p>\u8fd9\u79cd\u8bbe\u8ba1\u4f7f\u5f97 get \u64cd\u4f5c\u51e0\u4e4e\u4e0d\u53d7\u9501\u7ade\u4e89\u5f71\u54cd&#xff0c;\u6027\u80fd\u6781\u9ad8\u3002<\/p>\n<h3>\u4e03\u3001\u6269\u5bb9\u673a\u5236&#xff1a;\u591a\u7ebf\u7a0b\u534f\u540c\u4f5c\u6218<\/h3>\n<p>\u6269\u5bb9\u662f ConcurrentHashMap \u6700\u590d\u6742\u7684\u90e8\u5206&#xff0c;\u4e5f\u662f\u5b83\u533a\u522b\u4e8e\u666e\u901a HashMap \u7684\u6838\u5fc3\u4f18\u52bf\u2014\u2014\u652f\u6301\u591a\u7ebf\u7a0b\u534f\u540c\u6269\u5bb9\u3002<\/p>\n<h4>7.1 \u6269\u5bb9\u89e6\u53d1\u6761\u4ef6<\/h4>\n<p>\u6269\u5bb9\u5728 addCount \u65b9\u6cd5\u4e2d\u88ab\u89e6\u53d1&#xff1a;<\/p>\n<p>if (check &gt;&#061; 0) {<br \/>\n    Node&lt;K,V&gt;[] tab, nt; int n, sc;<br \/>\n    while (s &gt;&#061; (long)(sc &#061; sizeCtl) &amp;&amp; (tab &#061; table) !&#061; null &amp;&amp;<br \/>\n           (n &#061; tab.length) &lt; MAXIMUM_CAPACITY) {<br \/>\n        int rs &#061; resizeStamp(n);<br \/>\n        if (sc &lt; 0) {  \/\/ \u5df2\u6709\u7ebf\u7a0b\u5728\u6269\u5bb9<br \/>\n            if ((sc &gt;&gt;&gt; RESIZE_STAMP_SHIFT) !&#061; rs || sc &#061;&#061; rs &#043; 1 ||<br \/>\n                sc &#061;&#061; rs &#043; MAX_RESIZERS || (nt &#061; nextTable) &#061;&#061; null ||<br \/>\n                transferIndex &lt;&#061; 0)<br \/>\n                break;<br \/>\n            if (U.compareAndSetInt(this, SIZECTL, sc, sc &#043; 1))<br \/>\n                transfer(tab, nt);  \/\/ \u5f53\u524d\u7ebf\u7a0b\u534f\u52a9\u6269\u5bb9<br \/>\n        }<br \/>\n        else if (U.compareAndSetInt(this, SIZECTL, sc,<br \/>\n                                     (rs &lt;&lt; RESIZE_STAMP_SHIFT) &#043; 2))<br \/>\n            transfer(tab, null);  \/\/ \u5f53\u524d\u7ebf\u7a0b\u662f\u7b2c\u4e00\u4e2a\u53d1\u8d77\u6269\u5bb9\u7684<br \/>\n        s &#061; sumCount();<br \/>\n    }<br \/>\n}<\/p>\n<h4>7.2 transfer&#xff1a;\u6570\u636e\u8fc1\u79fb<\/h4>\n<p>transfer \u65b9\u6cd5\u8d1f\u8d23\u5c06\u65e7 table \u7684\u6570\u636e\u8fc1\u79fb\u5230\u65b0 table&#xff08;\u5bb9\u91cf\u7ffb\u500d&#xff09;&#xff1a;<\/p>\n<p>private final void transfer(Node&lt;K,V&gt;[] tab, Node&lt;K,V&gt;[] nextTab) {<br \/>\n    int n &#061; tab.length, stride;<br \/>\n    \/\/ \u8ba1\u7b97\u6bcf\u4e2a\u7ebf\u7a0b\u8d1f\u8d23\u7684\u6876\u4f4d\u6570&#xff08;\u6b65\u957f&#xff09;<br \/>\n    if ((stride &#061; (NCPU &gt; 1) ? (n &gt;&gt;&gt; 3) \/ NCPU : n) &lt; MIN_TRANSFER_STRIDE)<br \/>\n        stride &#061; MIN_TRANSFER_STRIDE;  \/\/ \u6700\u5c0f 16<\/p>\n<p>    if (nextTab &#061;&#061; null) {  \/\/ \u7b2c\u4e00\u4e2a\u53d1\u8d77\u6269\u5bb9\u7684\u7ebf\u7a0b\u521b\u5efa\u65b0\u6570\u7ec4<br \/>\n        try {<br \/>\n            Node&lt;K,V&gt;[] nt &#061; (Node&lt;K,V&gt;[])new Node&lt;?,?&gt;[n &lt;&lt; 1];  \/\/ \u5bb9\u91cf\u7ffb\u500d<br \/>\n            nextTab &#061; nt;<br \/>\n        } catch (Throwable ex) {<br \/>\n            sizeCtl &#061; Integer.MAX_VALUE;<br \/>\n            return;<br \/>\n        }<br \/>\n        nextTable &#061; nextTab;<br \/>\n        transferIndex &#061; n;  \/\/ \u4ece\u6700\u540e\u4e00\u4e2a\u6876\u5f00\u59cb\u5206\u914d\u4efb\u52a1<br \/>\n    }<\/p>\n<p>    int nextn &#061; nextTab.length;<br \/>\n    ForwardingNode&lt;K,V&gt; fwd &#061; new ForwardingNode&lt;K,V&gt;(nextTab);<br \/>\n    boolean advance &#061; true;<br \/>\n    boolean finishing &#061; false;<\/p>\n<p>    \/\/ \u81ea\u65cb\u8fc1\u79fb\u6570\u636e<br \/>\n    for (int i &#061; 0, bound &#061; 0;;) {<br \/>\n        \/\/ &#8230; \u5206\u914d\u4efb\u52a1\u3001\u8fc1\u79fb\u6570\u636e &#8230;<br \/>\n    }<br \/>\n}<\/p>\n<h4>7.3 \u6269\u5bb9\u7684\u6838\u5fc3\u8bbe\u8ba1\u8981\u70b9<\/h4>\n<li>\n<p>\u4efb\u52a1\u5206\u7247&#xff1a;\u6bcf\u4e2a\u7ebf\u7a0b\u6bcf\u6b21\u8d1f\u8d23 stride \u4e2a\u6876\u7684\u8fc1\u79fb&#xff08;\u9ed8\u8ba4 16&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u4ece\u540e\u5f80\u524d\u8fc1\u79fb&#xff1a;transferIndex \u8bb0\u5f55\u5168\u5c40\u8fc1\u79fb\u8fdb\u5ea6&#xff0c;\u4ece\u9ad8\u4f4d\u5411\u4f4e\u4f4d\u63a8\u8fdb<\/p>\n<\/li>\n<li>\n<p>FWD \u6807\u8bb0&#xff1a;\u8fc1\u79fb\u5b8c\u6210\u7684\u6876\u4f4d\u8bbe\u7f6e\u4e3a ForwardingNode&#xff0c;hash \u503c\u4e3a MOVED<\/p>\n<\/li>\n<li>\n<p>\u94fe\u8868\u62c6\u5206&#xff1a;\u539f\u94fe\u8868\u88ab\u62c6\u5206\u4e3a\u4e24\u4e2a\u94fe\u8868&#xff0c;\u5206\u522b\u653e\u5165\u65b0\u8868\u7684 i \u548c i &#043; n \u4f4d\u7f6e<\/p>\n<\/li>\n<li>\n<p>CAS \u63a7\u5236\u5e76\u53d1&#xff1a;\u901a\u8fc7 CAS \u4fee\u6539 sizeCtl \u548c transferIndex \u534f\u8c03\u591a\u7ebf\u7a0b<\/p>\n<\/li>\n<p>\u591a\u7ebf\u7a0b\u6269\u5bb9\u7684\u4f18\u52bf&#xff1a;\u6269\u5bb9\u65f6\u95f4\u968f\u7740\u53c2\u4e0e\u7ebf\u7a0b\u6570\u589e\u52a0\u800c\u7f29\u77ed&#xff0c;\u5145\u5206\u5229\u7528\u591a\u6838 CPU \u80fd\u529b\u3002<\/p>\n<h3>\u516b\u3001\u94fe\u8868 \u2194 \u7ea2\u9ed1\u6811\u8f6c\u6362<\/h3>\n<h4>8.1 \u94fe\u8868\u8f6c\u7ea2\u9ed1\u6811<\/h4>\n<p>\u5f53\u94fe\u8868\u957f\u5ea6 \u2265 8 \u4e14\u6570\u7ec4\u957f\u5ea6 \u2265 64 \u65f6&#xff0c;\u94fe\u8868\u8f6c\u6362\u4e3a\u7ea2\u9ed1\u6811&#xff1a;<\/p>\n<p>private final void treeifyBin(Node&lt;K,V&gt;[] tab, int index) {<br \/>\n    Node&lt;K,V&gt; b; int n, sc;<br \/>\n    if (tab !&#061; null) {<br \/>\n        if ((n &#061; tab.length) &lt; MIN_TREEIFY_CAPACITY)  \/\/ &lt; 64<br \/>\n            tryPresize(n &lt;&lt; 1);  \/\/ \u4f18\u5148\u6269\u5bb9<br \/>\n        else if ((b &#061; tabAt(tab, index)) !&#061; null &amp;&amp; b.hash &gt;&#061; 0) {<br \/>\n            synchronized (b) {<br \/>\n                if (tabAt(tab, index) &#061;&#061; b) {<br \/>\n                    \/\/ \u5c06\u94fe\u8868\u8282\u70b9\u8f6c\u4e3a TreeNode&#xff0c;\u7136\u540e\u6784\u5efa\u7ea2\u9ed1\u6811<br \/>\n                    TreeNode&lt;K,V&gt; hd &#061; null, tl &#061; null;<br \/>\n                    for (Node&lt;K,V&gt; e &#061; b; e !&#061; null; e &#061; e.next) {<br \/>\n                        TreeNode&lt;K,V&gt; p &#061; new TreeNode&lt;K,V&gt;(e.hash, e.key, e.val, null, null);<br \/>\n                        if ((p.prev &#061; tl) &#061;&#061; null) hd &#061; p;<br \/>\n                        else tl.next &#061; p;<br \/>\n                        tl &#061; p;<br \/>\n                    }<br \/>\n                    \/\/ \u7528 TreeBin \u66ff\u4ee3\u539f\u94fe\u8868\u5934\u8282\u70b9<br \/>\n                    setTabAt(tab, index, new TreeBin&lt;K,V&gt;(hd));<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>\u4e3a\u4ec0\u4e48\u9608\u503c\u662f 8&#xff1f; \u6e90\u7801\u6ce8\u91ca\u6307\u51fa&#xff0c;\u5728\u7406\u60f3\u60c5\u51b5\u4e0b&#xff0c;\u6876\u4e2d\u8282\u70b9\u6570\u670d\u4ece\u6cca\u677e\u5206\u5e03&#xff0c;\u4e00\u4e2a\u6876\u4e2d\u51fa\u73b0 8 \u4e2a\u8282\u70b9\u7684\u6982\u7387\u4ec5\u4e3a 0.00000006\u3002\u56e0\u6b64 8 \u662f\u4e00\u4e2a\u8db3\u591f\u4fdd\u5b88\u7684\u9608\u503c\u3002<\/p>\n<h4>8.2 \u7ea2\u9ed1\u6811\u8f6c\u94fe\u8868<\/h4>\n<p>\u5f53\u7ea2\u9ed1\u6811\u8282\u70b9\u6570\u51cf\u5c11\u5230 \u2264 6 \u65f6&#xff0c;\u6811\u9000\u5316\u4e3a\u94fe\u8868\u3002<\/p>\n<h3>\u4e5d\u3001\u603b\u7ed3<\/h3>\n<p>ConcurrentHashMap \u662f Java \u5e76\u53d1\u5bb9\u5668\u4e2d\u6700\u95ea\u8000\u7684\u660e\u661f&#xff0c;\u5b83\u7684\u8bbe\u8ba1\u4f53\u73b0\u4e86 Java \u5728\u5e76\u53d1\u7f16\u7a0b\u9886\u57df\u7684\u4e0d\u65ad\u8fdb\u6b65&#xff1a;<\/p>\n<h4>\u6838\u5fc3\u8981\u70b9\u56de\u987e<\/h4>\n<li>\n<p>\u6570\u636e\u7ed3\u6784&#xff1a;\u6570\u7ec4 &#043; \u94fe\u8868 &#043; \u7ea2\u9ed1\u6811&#xff0c;\u4e0e HashMap 1.8 \u4fdd\u6301\u4e00\u81f4<\/p>\n<\/li>\n<li>\n<p>\u7ebf\u7a0b\u5b89\u5168\u673a\u5236&#xff1a;CAS&#xff08;\u65e0\u7ade\u4e89\u573a\u666f&#xff09;&#043; synchronized&#xff08;\u9501\u5934\u8282\u70b9&#xff09;&#xff0c;\u6452\u5f03\u4e86 Segment \u5206\u6bb5\u9501<\/p>\n<\/li>\n<li>\n<p>\u9501\u7c92\u5ea6&#xff1a;\u4ece Segment \u7ea7\u522b\u7ec6\u5316\u5230\u5355\u4e2a\u6876\u8282\u70b9&#xff0c;\u5e76\u53d1\u5ea6\u5927\u5e45\u63d0\u5347<\/p>\n<\/li>\n<li>\n<p>\u65e0\u9501\u8bfb\u53d6&#xff1a;get \u65b9\u6cd5\u5168\u7a0b\u4e0d\u52a0\u9501&#xff0c;\u4f9d\u8d56 volatile \u4fdd\u8bc1\u53ef\u89c1\u6027<\/p>\n<\/li>\n<li>\n<p>\u591a\u7ebf\u7a0b\u6269\u5bb9&#xff1a;\u652f\u6301\u591a\u7ebf\u7a0b\u534f\u540c\u5b8c\u6210\u6570\u636e\u8fc1\u79fb&#xff0c;\u5145\u5206\u5229\u7528\u591a\u6838 CPU<\/p>\n<\/li>\n<li>\n<p>\u5ef6\u8fdf\u521d\u59cb\u5316&#xff1a;table \u5728\u7b2c\u4e00\u6b21 put \u65f6\u624d\u771f\u6b63\u521b\u5efa<\/p>\n<\/li>\n<li>\n<p>put\u64cd\u4f5c\u6d41\u7a0b:\u9996\u5148\u5148\u5224\u65adkey\u548cvalue\u662f\u5426\u4e3a\u7a7a&#xff0c;\u5982\u679c\u4e3a\u7a7a&#xff0c;\u5219\u629b\u51fa\u5f02\u5e38&#xff0c;\u7136\u540e\u8ba1\u7b97\u54c8\u5e0c\u503c&#xff0c;\u8fdb\u5165\u81ea\u65cb\u64cd\u4f5c(CAS&#xff09;&#xff0c;\u5982\u679ctable\u4e3a\u7a7a&#xff0c;\u5219CAS\u521d\u59cb\u5316table&#xff0c;\u5982\u679c\u662f\u6b63\u5728\u6269\u5bb9&#xff0c;\u5219\u534f\u52a9\u6269\u5bb9&#xff0c;\u5982\u679c\u6876\u4e3a\u7a7a&#xff0c;\u5219\u76f4\u63a5CAS\u63d2\u5165&#xff0c;\u5982\u679c\u6876\u4f4d\u6709\u8282\u70b9&#xff0c;\u5219synchronized\u9501\u4f4f\u5934\u8282\u70b9&#xff0c;\u904d\u5386\u94fe\u8868&#xff0c;\u6709\u76f8\u540c\u7684\u5219\u66ff\u6362&#xff0c;\u6ca1\u6709\u5219\u63d2\u5165&#xff0c;\u7136\u540e\u5224\u65ad\u662f\u5426\u9700\u8981\u6811\u5316\u3002<\/p>\n<\/li>\n<li>\n<p>get\u64cd\u4f5c\u6d41\u7a0b:\u9996\u5148\u8ba1\u7b97\u54c8\u5e0c\u503c&#xff0c;\u5b9a\u4f4d\u6876&#xff0c;\u68c0\u67e5\u9996\u8282\u70b9&#xff0c;\u76f8\u540c\u5219\u76f4\u63a5\u8fd4\u56de&#xff0c;\u5982\u679c\u662ffwd\u6269\u5bb9\u4e2d \u5219\u53bbnextable\u4e2d\u5bfb\u627e&#xff0c;\u5982\u679c\u662ftreebin&#xff0c;\u5219\u53bb\u6811\u4e2d\u904d\u5386&#xff0c;\u5426\u5219\u53bb\u94fe\u8868\u4e2d\u904d\u5386\u3002<\/p>\n<\/li>\n<h4>\u6027\u80fd\u5bf9\u6bd4<\/h4>\n<table>\n<tbody>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u5bb9\u5668<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u7ebf\u7a0b\u5b89\u5168<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u5e76\u53d1\u6027\u80fd<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u9002\u7528\u573a\u666f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>HashMap<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u274c<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u6700\u9ad8<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u5355\u7ebf\u7a0b\u73af\u5883<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>Hashtable<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u2705&#xff08;\u5168\u8868\u9501&#xff09;<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u6781\u4f4e<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u9057\u7559\u4ee3\u7801<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>ConcurrentHashMap (JDK 7)<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u2705&#xff08;\u5206\u6bb5\u9501&#xff09;<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u4e2d<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u4e2d\u7b49\u5e76\u53d1<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td colspan=\"1\" rowspan=\"1\">\n<p>ConcurrentHashMap (JDK 8)<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u2705&#xff08;CAS &#043; \u9501\u5934\u8282\u70b9&#xff09;<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u9ad8<\/p>\n<\/td>\n<td colspan=\"1\" rowspan=\"1\">\n<p>\u9ad8\u5e76\u53d1\u9996\u9009<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>ConcurrentHashMap \u7684\u6210\u529f&#xff0c;\u6e90\u4e8e\u5b83\u5bf9\u5e76\u53d1\u6027\u80fd\u548c\u7ebf\u7a0b\u5b89\u5168\u7684\u7cbe\u5999\u5e73\u8861\u3002\u65e0\u8bba\u662f\u9762\u8bd5\u8fd8\u662f\u65e5\u5e38\u5f00\u53d1&#xff0c;\u6df1\u5165\u7406\u89e3\u5b83\u7684\u8bbe\u8ba1\u601d\u60f3&#xff0c;\u90fd\u80fd\u8ba9\u4f60\u5199\u51fa\u66f4\u9ad8\u6548\u3001\u66f4\u5b89\u5168\u7684\u5e76\u53d1\u4ee3\u7801\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u5f15\u8a00&#xff1a;HashMap \u7684\u7ebf\u7a0b\u5b89\u5168\u56f0\u5883HashMap \u662f Java \u4e2d\u6700\u5e38\u7528\u7684\u5bb9\u5668\u4e4b\u4e00&#xff0c;\u4f46\u5b83\u6709\u4e00\u4e2a\u81f4\u547d\u7f3a\u9677\u2014\u2014\u7ebf\u7a0b\u4e0d\u5b89\u5168\u3002\u5728\u591a\u7ebf\u7a0b\u73af\u5883\u4e0b&#xff0c;HashMap \u5728\u6269\u5bb9\u65f6\u53ef\u80fd\u5f62\u6210\u73af\u5f62\u94fe\u8868&#xff0c;\u5bfc\u81f4 get() \u64cd\u4f5c\u9677\u5165\u6b7b\u5faa\u73af&#xff0c;CPU \u98d9\u5347\u5230 100%\u3002\u90a3\u7528 Hashtable \u5462&#xff1f;\u5b83\u6240\u6709\u65b9\u6cd5\u90fd\u52a0\u4e86 synchronized&#xff0c;\u76f8\u5f53\u4e8e\u7ed9\u6574\u5f20\u8868\u4e0a\u4e86\u4e00\u628a\u5927\u9501&#xff0c;\u540c\u4e00\u65f6\u523b\u53ea\u5141\u8bb8\u4e00\u4e2a\u7ebf\u7a0b\u64cd<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99],"topic":[],"class_list":["post-88882","post","type-post","status-publish","format-standard","hentry","category-server","tag-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>ConcurrentHashMap \u6df1\u5ea6\u89e3\u6790\uff1a\u4ece\u5206\u6bb5\u9501\u5230 CAS \u7684\u8fdb\u5316\u4e4b\u8def - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/88882.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ConcurrentHashMap \u6df1\u5ea6\u89e3\u6790\uff1a\u4ece\u5206\u6bb5\u9501\u5230 CAS \u7684\u8fdb\u5316\u4e4b\u8def - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4e00\u3001\u5f15\u8a00&#xff1a;HashMap \u7684\u7ebf\u7a0b\u5b89\u5168\u56f0\u5883HashMap \u662f Java \u4e2d\u6700\u5e38\u7528\u7684\u5bb9\u5668\u4e4b\u4e00&#xff0c;\u4f46\u5b83\u6709\u4e00\u4e2a\u81f4\u547d\u7f3a\u9677\u2014\u2014\u7ebf\u7a0b\u4e0d\u5b89\u5168\u3002\u5728\u591a\u7ebf\u7a0b\u73af\u5883\u4e0b&#xff0c;HashMap \u5728\u6269\u5bb9\u65f6\u53ef\u80fd\u5f62\u6210\u73af\u5f62\u94fe\u8868&#xff0c;\u5bfc\u81f4 get() \u64cd\u4f5c\u9677\u5165\u6b7b\u5faa\u73af&#xff0c;CPU \u98d9\u5347\u5230 100%\u3002\u90a3\u7528 Hashtable \u5462&#xff1f;\u5b83\u6240\u6709\u65b9\u6cd5\u90fd\u52a0\u4e86 synchronized&#xff0c;\u76f8\u5f53\u4e8e\u7ed9\u6574\u5f20\u8868\u4e0a\u4e86\u4e00\u628a\u5927\u9501&#xff0c;\u540c\u4e00\u65f6\u523b\u53ea\u5141\u8bb8\u4e00\u4e2a\u7ebf\u7a0b\u64cd\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/88882.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-08-01T13:40:31+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/88882.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/88882.html\",\"name\":\"ConcurrentHashMap \u6df1\u5ea6\u89e3\u6790\uff1a\u4ece\u5206\u6bb5\u9501\u5230 CAS \u7684\u8fdb\u5316\u4e4b\u8def - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-08-01T13:40:31+00:00\",\"dateModified\":\"2026-08-01T13:40:31+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/88882.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/88882.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/88882.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ConcurrentHashMap \u6df1\u5ea6\u89e3\u6790\uff1a\u4ece\u5206\u6bb5\u9501\u5230 CAS \u7684\u8fdb\u5316\u4e4b\u8def\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ConcurrentHashMap \u6df1\u5ea6\u89e3\u6790\uff1a\u4ece\u5206\u6bb5\u9501\u5230 CAS \u7684\u8fdb\u5316\u4e4b\u8def - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/88882.html","og_locale":"zh_CN","og_type":"article","og_title":"ConcurrentHashMap \u6df1\u5ea6\u89e3\u6790\uff1a\u4ece\u5206\u6bb5\u9501\u5230 CAS \u7684\u8fdb\u5316\u4e4b\u8def - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4e00\u3001\u5f15\u8a00&#xff1a;HashMap \u7684\u7ebf\u7a0b\u5b89\u5168\u56f0\u5883HashMap \u662f Java \u4e2d\u6700\u5e38\u7528\u7684\u5bb9\u5668\u4e4b\u4e00&#xff0c;\u4f46\u5b83\u6709\u4e00\u4e2a\u81f4\u547d\u7f3a\u9677\u2014\u2014\u7ebf\u7a0b\u4e0d\u5b89\u5168\u3002\u5728\u591a\u7ebf\u7a0b\u73af\u5883\u4e0b&#xff0c;HashMap \u5728\u6269\u5bb9\u65f6\u53ef\u80fd\u5f62\u6210\u73af\u5f62\u94fe\u8868&#xff0c;\u5bfc\u81f4 get() \u64cd\u4f5c\u9677\u5165\u6b7b\u5faa\u73af&#xff0c;CPU \u98d9\u5347\u5230 100%\u3002\u90a3\u7528 Hashtable \u5462&#xff1f;\u5b83\u6240\u6709\u65b9\u6cd5\u90fd\u52a0\u4e86 synchronized&#xff0c;\u76f8\u5f53\u4e8e\u7ed9\u6574\u5f20\u8868\u4e0a\u4e86\u4e00\u628a\u5927\u9501&#xff0c;\u540c\u4e00\u65f6\u523b\u53ea\u5141\u8bb8\u4e00\u4e2a\u7ebf\u7a0b\u64cd","og_url":"https:\/\/www.wsisp.com\/helps\/88882.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-08-01T13:40:31+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"8 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/88882.html","url":"https:\/\/www.wsisp.com\/helps\/88882.html","name":"ConcurrentHashMap \u6df1\u5ea6\u89e3\u6790\uff1a\u4ece\u5206\u6bb5\u9501\u5230 CAS \u7684\u8fdb\u5316\u4e4b\u8def - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-08-01T13:40:31+00:00","dateModified":"2026-08-01T13:40:31+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/88882.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/88882.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/88882.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"ConcurrentHashMap \u6df1\u5ea6\u89e3\u6790\uff1a\u4ece\u5206\u6bb5\u9501\u5230 CAS \u7684\u8fdb\u5316\u4e4b\u8def"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/88882","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=88882"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/88882\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=88882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=88882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=88882"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=88882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}