{"id":37701,"date":"2023-12-11T14:42:16","date_gmt":"2023-12-11T06:42:16","guid":{"rendered":"https:\/\/wx.kaifamiao.info\/?p=37701"},"modified":"2023-12-11T14:42:16","modified_gmt":"2023-12-11T06:42:16","slug":"%e5%9c%a8-java-%e7%a8%8b%e5%ba%8f%e4%b8%ad%e6%80%8e%e4%b9%88%e4%bf%9d%e8%af%81%e5%a4%9a%e7%ba%bf%e7%a8%8b%e7%9a%84%e8%bf%90%e8%a1%8c%e5%ae%89%e5%85%a8%ef%bc%9f-2","status":"publish","type":"post","link":"http:\/\/wx.kaifamiao.info\/index.php\/2023\/12\/11\/%e5%9c%a8-java-%e7%a8%8b%e5%ba%8f%e4%b8%ad%e6%80%8e%e4%b9%88%e4%bf%9d%e8%af%81%e5%a4%9a%e7%ba%bf%e7%a8%8b%e7%9a%84%e8%bf%90%e8%a1%8c%e5%ae%89%e5%85%a8%ef%bc%9f-2\/","title":{"rendered":"\u5728 Java \u7a0b\u5e8f\u4e2d\u600e\u4e48\u4fdd\u8bc1\u591a\u7ebf\u7a0b\u7684\u8fd0\u884c\u5b89\u5168\uff1f"},"content":{"rendered":"<p>&#8220;`&#8221;                    \u65b9\u6cd5\u4e00\uff1a\u4f7f\u7528\u5b89\u5168\u7c7b\uff0c\u6bd4\u5982 Java. util. concurrent \u4e0b\u7684\u7c7b\u3002<\/p>\n<p>\u65b9\u6cd5\u4e8c\uff1a\u4f7f\u7528\u81ea\u52a8\u9501 synchronized\u3002<\/p>\n<p>\u65b9\u6cd5\u4e09\uff1a\u4f7f\u7528\u624b\u52a8\u9501 Lock\u3002\u624b\u52a8\u9501 Java \u793a\u4f8b\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<p>&lt;pre&gt;&lt;code&gt;Lock lock = new ReentrantLock();lock. lock();try {System. out. println(&quot;&quot;\u83b7\u5f97\u9501&quot;&quot;);} catch (Exception e) {\/\/ TODO: handle exception} finally {System. out. println(&quot;&quot;\u91ca\u653e\u9501&quot;&quot;);lock. unlock();}&lt;\/code&gt;&lt;\/pre&gt;<\/p>\n<p>\u00a0<\/p>\n<p>&lt;pre&gt;&lt;code&gt;            &quot;&#8220;`<br \/>\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;`&#8221; \u65b9\u6cd5\u4e00\uff1a\u4f7f\u7528\u5b89\u5168\u7c7b\uff0c\u6bd4\u5982 Java. util. concurrent \u4e0b\u7684\u7c7b [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-37701","post","type-post","status-publish","format-standard","hentry","category-c"],"_links":{"self":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/37701","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/comments?post=37701"}],"version-history":[{"count":1,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/37701\/revisions"}],"predecessor-version":[{"id":37702,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/posts\/37701\/revisions\/37702"}],"wp:attachment":[{"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/media?parent=37701"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/categories?post=37701"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wx.kaifamiao.info\/index.php\/wp-json\/wp\/v2\/tags?post=37701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}