{"id":53070,"date":"2025-08-11T23:59:30","date_gmt":"2025-08-11T15:59:30","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/53070.html"},"modified":"2025-08-11T23:59:30","modified_gmt":"2025-08-11T15:59:30","slug":"java%e5%a4%9a%e7%ba%bf%e7%a8%8b%e5%b9%b6%e5%8f%91%e6%8e%a7%e5%88%b6%ef%bc%9a%e4%bd%bf%e7%94%a8reentrantlock%e5%ae%9e%e7%8e%b0%e7%94%9f%e4%ba%a7%e8%80%85-%e6%b6%88%e8%b4%b9%e8%80%85%e6%a8%a1%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/53070.html","title":{"rendered":"Java\u591a\u7ebf\u7a0b\u5e76\u53d1\u63a7\u5236\uff1a\u4f7f\u7528ReentrantLock\u5b9e\u73b0\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u6a21\u578b"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"579\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250811155923-689a135b8ec43.png\" width=\"1035\" \/><\/p>\n<p>&#x1f31f; \u4f60\u597d&#xff0c;\u6211\u662f \u52b1\u5fd7\u6210\u4e3a\u7cd5\u624b &#xff01; &#x1f30c; \u5728\u4ee3\u7801\u7684\u5b87\u5b99\u4e2d&#xff0c;\u6211\u662f\u90a3\u4e2a\u8ffd\u9010\u4f18\u96c5\u4e0e\u6027\u80fd\u7684\u661f\u9645\u65c5\u4eba\u3002<\/p>\n<p>\u2728 \u6bcf\u4e00\u884c\u4ee3\u7801\u90fd\u662f\u6211\u79cd\u4e0b\u7684\u661f\u5149&#xff0c;\u5728\u903b\u8f91\u7684\u571f\u58e4\u91cc\u751f\u957f\u6210\u7480\u74a8\u7684\u94f6\u6cb3&#xff1b; &#x1f6e0;\ufe0f \u6bcf\u4e00\u4e2a\u7b97\u6cd5\u90fd\u662f\u6211\u7ed8\u5236\u7684\u661f\u56fe&#xff0c;\u6307\u5f15\u7740\u6570\u636e\u6d41\u52a8\u7684\u6700\u77ed\u8def\u5f84&#xff1b; &#x1f50d; \u6bcf\u4e00\u6b21\u8c03\u8bd5\u90fd\u662f\u661f\u9645\u5bf9\u8bdd&#xff0c;\u7528\u8010\u5fc3\u548c\u667a\u6167\u89e3\u5f00\u5b87\u5b99\u7684\u8c1c\u9898\u3002<\/p>\n<p>&#x1f680; \u51c6\u5907\u597d\u5f00\u59cb\u6211\u4eec\u7684\u661f\u9645\u7f16\u7801\u4e4b\u65c5\u4e86\u5417&#xff1f;<\/p>\n<h2>\u6458\u8981&#xff1a;\u5e76\u53d1\u7f16\u7a0b\u7684\u827a\u672f\u63a2\u7d22<\/h2>\n<p>\u5b66\u4e60Java\u5df2\u6709\u4e24\u5e74\u6709\u4f59&#xff0c;\u6211\u59cb\u7ec8\u88ab\u591a\u7ebf\u7a0b\u7f16\u7a0b\u7684\u6311\u6218\u4e0e\u9b45\u529b\u6240\u5438\u5f15\u3002\u4eca\u5929&#xff0c;\u6211\u5c06\u5e26\u9886\u5927\u5bb6\u6df1\u5165\u63a2\u8ba8\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u8fd9\u4e00\u7ecf\u5178\u5e76\u53d1\u95ee\u9898\u7684\u4f18\u96c5\u89e3\u51b3\u65b9\u6848\u2014\u2014\u4f7f\u7528ReentrantLock\u66ff\u4ee3\u4f20\u7edf\u7684synchronized\u5173\u952e\u5b57\u3002\u5728\u672c\u6587\u4e2d&#xff0c;\u6211\u4f1a\u5206\u4eab\u5982\u4f55\u901a\u8fc7Lock\u63a5\u53e3\u7684\u7cbe\u7ec6\u63a7\u5236\u80fd\u529b&#xff0c;\u7ed3\u5408Condition\u7684\u6761\u4ef6\u7b49\u5f85\u673a\u5236&#xff0c;\u6784\u5efa\u51fa\u9ad8\u541e\u5410\u91cf\u4e14\u7ebf\u7a0b\u5b89\u5168\u7684\u6570\u636e\u4ea4\u6362\u7cfb\u7edf\u3002\u6211\u4eec\u5c06\u4ece\u5e76\u53d1\u6a21\u578b\u7684\u6838\u5fc3\u75db\u70b9\u51fa\u53d1&#xff0c;\u5256\u6790\u4f20\u7edfsynchronized\u65b9\u6848\u7684\u5c40\u9650\u6027&#xff0c;\u63ed\u793aReentrantLock\u5728\u53ef\u4e2d\u65ad\u9501\u83b7\u53d6\u3001\u516c\u5e73\u6027\u7b56\u7565\u4ee5\u53ca\u591a\u6761\u4ef6\u53d8\u91cf\u652f\u6301\u7b49\u65b9\u9762\u7684\u72ec\u7279\u4f18\u52bf\u3002\u901a\u8fc7\u7cbe\u5fc3\u8bbe\u8ba1\u7684\u4ee3\u7801\u793a\u4f8b&#xff0c;\u4f60\u5c06\u770b\u5230\u5982\u4f55\u907f\u514d\u7ebf\u7a0b\u865a\u5047\u5524\u9192&#xff0c;\u5982\u4f55\u5b9e\u73b0\u7cbe\u51c6\u7684\u7ebf\u7a0b\u95f4\u534f\u4f5c&#xff0c;\u4ee5\u53ca\u5982\u4f55\u901a\u8fc7\u9501\u5206\u79bb\u6280\u672f\u63d0\u5347\u7cfb\u7edf\u541e\u5410\u91cf\u3002\u672c\u6587\u4e0d\u4ec5\u5305\u542b\u53ef\u76f4\u63a5\u7528\u4e8e\u751f\u4ea7\u73af\u5883\u7684\u4ee3\u7801\u5b9e\u73b0&#xff0c;\u8fd8\u901a\u8fc7\u53ef\u89c6\u5316\u56fe\u8868\u5c55\u793a\u4e86\u7ebf\u7a0b\u72b6\u6001\u53d8\u8fc1\u548c\u7cfb\u7edf\u67b6\u6784\u6f14\u8fdb\u3002\u65e0\u8bba\u4f60\u662f\u6b63\u5728\u5e94\u5bf9\u9ad8\u5e76\u53d1\u573a\u666f\u7684\u67b6\u6784\u5e08&#xff0c;\u8fd8\u662f\u6e34\u671b\u6df1\u5165\u7406\u89e3Java\u5e76\u53d1\u673a\u5236\u7684\u5f00\u53d1\u8005&#xff0c;\u8fd9\u7bc7\u6587\u7ae0\u90fd\u5c06\u4e3a\u4f60\u63d0\u4f9b\u503c\u5f97\u6536\u85cf\u7684\u6280\u672f\u5b9e\u8df5\u65b9\u6848\u3002\u8ba9\u6211\u4eec\u5171\u540c\u63a2\u7d22\u8fd9\u628a\u6bd4synchronized\u66f4\u950b\u5229\u7684\u5e76\u53d1\u63a7\u5236\u5229\u5668&#xff0c;\u5728\u8d44\u6e90\u7ade\u4e89\u4e0e\u7ebf\u7a0b\u534f\u4f5c\u7684\u5e73\u8861\u6728\u4e0a\u8d70\u51fa\u4f18\u96c5\u7684\u6280\u672f\u821e\u6b65\u3002<\/p>\n<h2>\u4e00\u3001\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u6a21\u578b\u7684\u6838\u5fc3\u6311\u6218<\/h2>\n<p>\u5728\u591a\u7ebf\u7a0b\u73af\u5883\u4e0b&#xff0c;\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u6a21\u5f0f\u9700\u8981\u89e3\u51b3\u4e09\u4e2a\u6838\u5fc3\u95ee\u9898&#xff1a;<\/p>\n<p>1. **\u7ebf\u7a0b\u5b89\u5168**&#xff1a;\u5171\u4eab\u7f13\u51b2\u533a\u7684\u5e76\u53d1\u8bbf\u95ee\u63a7\u5236<\/p>\n<p>2. **\u8d44\u6e90\u534f\u8c03**&#xff1a;\u7f13\u51b2\u533a\u6ee1\/\u7a7a\u65f6\u7684\u7ebf\u7a0b\u7b49\u5f85\u4e0e\u5524\u9192<\/p>\n<p>3. **\u6027\u80fd\u4f18\u5316**&#xff1a;\u51cf\u5c11\u7ebf\u7a0b\u7ade\u4e89\u5e26\u6765\u7684\u6027\u80fd\u635f\u8017<\/p>\n<p>\u4f20\u7edfsynchronized\u65b9\u6848\u7684\u5c40\u9650&#xff1a;<\/p>\n<p>\/\/ \u4f20\u7edfsynchronized\u5b9e\u73b0<br \/>\npublic synchronized void put(Object item) throws InterruptedException {<br \/>\n\u00a0\u00a0\u00a0 while (count &#061;&#061; items.length)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 wait();\u00a0 \/\/ \u7f13\u51b2\u533a\u6ee1\u65f6\u7b49\u5f85<br \/>\n\u00a0\u00a0\u00a0 \/\/ &#8230; \u6dfb\u52a0\u5143\u7d20<br \/>\n\u00a0\u00a0\u00a0 notifyAll(); \/\/ \u5524\u9192\u6240\u6709\u7b49\u5f85\u7ebf\u7a0b<br \/>\n} <\/p>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u5b58\u5728\u4e24\u4e2a\u4e3b\u8981\u7f3a\u9677&#xff1a;<\/p>\n<li>\n<p>\u4f7f\u7528notifyAll()\u4f1a\u5524\u9192\u6240\u6709\u7b49\u5f85\u7ebf\u7a0b&#xff0c;\u5bfc\u81f4\u4e0d\u5fc5\u8981\u7684\u7ade\u4e89<\/p>\n<\/li>\n<li>\n<p>\u65e0\u6cd5\u533a\u5206\u5524\u9192\u751f\u4ea7\u8005\u548c\u6d88\u8d39\u8005\u7684\u6761\u4ef6<\/p>\n<\/li>\n<h3>\u4e8c\u3001ReentrantLock\u7684\u8fdb\u9636\u7279\u6027<\/h3>\n<h4>2.1 ReentrantLock vs synchronized \u5bf9\u6bd4<\/h4>\n<table>\n<tr>\u7279\u6027ReentrantLocksynchronized<\/tr>\n<tbody>\n<tr>\n<td>\u9501\u83b7\u53d6\u673a\u5236<\/td>\n<td>\u53ef\u8f6e\u8be2\u3001\u5b9a\u65f6\u3001\u53ef\u4e2d\u65ad<\/td>\n<td>\u963b\u585e\u83b7\u53d6<\/td>\n<\/tr>\n<tr>\n<td>\u516c\u5e73\u6027<\/td>\n<td>\u652f\u6301\u516c\u5e73\/\u975e\u516c\u5e73\u7b56\u7565<\/td>\n<td>\u975e\u516c\u5e73<\/td>\n<\/tr>\n<tr>\n<td>\u6761\u4ef6\u53d8\u91cf<\/td>\n<td>\u652f\u6301\u591a\u4e2aCondition<\/td>\n<td>\u5355\u4e00\u7b49\u5f85\u961f\u5217<\/td>\n<\/tr>\n<tr>\n<td>\u9501\u91ca\u653e<\/td>\n<td>\u5fc5\u987b\u663e\u5f0f\u8c03\u7528unlock()<\/td>\n<td>\u81ea\u52a8\u91ca\u653e<\/td>\n<\/tr>\n<tr>\n<td>\u6027\u80fd<\/td>\n<td>\u9ad8\u7ade\u4e89\u4e0b\u8868\u73b0\u66f4\u597d<\/td>\n<td>\u4f4e\u7ade\u4e89\u4e0b\u66f4\u4f18<\/td>\n<\/tr>\n<tr>\n<td>\u9501\u7ed1\u5b9a<\/td>\n<td>\u652f\u6301\u7ed1\u5b9a\u591a\u4e2a\u6761\u4ef6<\/td>\n<td>\u4e0d\u652f\u6301<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Brian Goetz\u5728\u300aJava\u5e76\u53d1\u7f16\u7a0b\u5b9e\u6218\u300b\u4e2d\u6307\u51fa&#xff1a; &#034;\u663e\u5f0f\u9501\u63d0\u4f9b\u4e86\u66f4\u7ec6\u7c92\u5ea6\u7684\u63a7\u5236\u80fd\u529b&#xff0c;\u4f46\u9700\u8981\u5f00\u53d1\u8005\u627f\u62c5\u66f4\u591a\u7684\u8d23\u4efb\u3002&#034;<\/p>\n<h4>2.2 Condition\u7684\u7cbe\u51c6\u63a7\u5236<\/h4>\n<p>ReentrantLock lock &#061; new ReentrantLock();<br \/>\nCondition notFull &#061; lock.newCondition();  \/\/ \u7f13\u51b2\u533a\u672a\u6ee1\u6761\u4ef6<br \/>\nCondition notEmpty &#061; lock.newCondition(); \/\/ \u7f13\u51b2\u533a\u975e\u7a7a\u6761\u4ef6 <\/p>\n<p>\u901a\u8fc7\u5206\u79bb\u7684\u6761\u4ef6\u53d8\u91cf&#xff0c;\u6211\u4eec\u53ef\u4ee5\u5b9e\u73b0&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u751f\u4ea7\u8005\u53ea\u5728notFull\u6761\u4ef6\u4e0a\u7b49\u5f85<\/p>\n<\/li>\n<li>\n<p>\u6d88\u8d39\u8005\u53ea\u5728notEmpty\u6761\u4ef6\u4e0a\u7b49\u5f85<\/p>\n<\/li>\n<li>\n<p>\u7cbe\u51c6\u5524\u9192\u7279\u5b9a\u7c7b\u578b\u7684\u7ebf\u7a0b<\/p>\n<\/li>\n<\/ul>\n<h3>\u4e09\u3001\u5b8c\u6574\u5b9e\u73b0\u65b9\u6848<\/h3>\n<h4>3.1 \u57fa\u4e8eReentrantLock\u7684\u73af\u5f62\u7f13\u51b2\u533a<\/h4>\n<p>import java.util.concurrent.locks.*;<\/p>\n<p>public class BlockingQueue&lt;T&gt; {<br \/>\n    private final T[] items;<br \/>\n    private int putIndex, takeIndex, count;<\/p>\n<p>    private final ReentrantLock lock;<br \/>\n    private final Condition notFull;<br \/>\n    private final Condition notEmpty;<\/p>\n<p>    public BlockingQueue(int capacity) {<br \/>\n        this.items &#061; (T[]) new Object[capacity];<br \/>\n        this.lock &#061; new ReentrantLock(true); \/\/ \u516c\u5e73\u9501<br \/>\n        this.notFull &#061; lock.newCondition();<br \/>\n        this.notEmpty &#061; lock.newCondition();<br \/>\n    }<\/p>\n<p>    public void put(T item) throws InterruptedException {<br \/>\n        lock.lockInterruptibly();  \/\/ \u53ef\u4e2d\u65ad\u9501<br \/>\n        try {<br \/>\n            while (count &#061;&#061; items.length) {<br \/>\n                notFull.await();  \/\/ \u7b49\u5f85\u7f13\u51b2\u533a\u672a\u6ee1<br \/>\n            }<br \/>\n            items[putIndex] &#061; item;<br \/>\n            if (&#043;&#043;putIndex &#061;&#061; items.length) putIndex &#061; 0;<br \/>\n            count&#043;&#043;;<br \/>\n            notEmpty.signal();  \/\/ \u5524\u9192\u4e00\u4e2a\u6d88\u8d39\u8005<br \/>\n        } finally {<br \/>\n            lock.unlock();<br \/>\n        }<br \/>\n    }<\/p>\n<p>    public T take() throws InterruptedException {<br \/>\n        lock.lockInterruptibly();<br \/>\n        try {<br \/>\n            while (count &#061;&#061; 0) {<br \/>\n                notEmpty.await();  \/\/ \u7b49\u5f85\u7f13\u51b2\u533a\u975e\u7a7a<br \/>\n            }<br \/>\n            T item &#061; items[takeIndex];<br \/>\n            items[takeIndex] &#061; null; \/\/ GC\u53cb\u597d<br \/>\n            if (&#043;&#043;takeIndex &#061;&#061; items.length) takeIndex &#061; 0;<br \/>\n            count&#8211;;<br \/>\n            notFull.signal();  \/\/ \u5524\u9192\u4e00\u4e2a\u751f\u4ea7\u8005<br \/>\n            return item;<br \/>\n        } finally {<br \/>\n            lock.unlock();<br \/>\n        }<br \/>\n    }<br \/>\n} <\/p>\n<h4>\u5173\u952e\u4ee3\u7801\u89e3\u6790&#xff1a;<\/h4>\n<li>\n<p>\u9501\u83b7\u53d6&#xff1a;\u4f7f\u7528lockInterruptibly()\u652f\u6301\u7ebf\u7a0b\u4e2d\u65ad\u54cd\u5e94<\/p>\n<\/li>\n<li>\n<p>\u6761\u4ef6\u7b49\u5f85&#xff1a;await()\u8c03\u7528\u4f1a\u81ea\u52a8\u91ca\u653e\u9501&#xff0c;\u5524\u9192\u540e\u91cd\u65b0\u83b7\u53d6<\/p>\n<\/li>\n<li>\n<p>\u7cbe\u51c6\u901a\u77e5&#xff1a;signal()\u53ea\u5524\u9192\u540c\u4e00\u6761\u4ef6\u4e0a\u7684\u4e00\u4e2a\u7b49\u5f85\u7ebf\u7a0b<\/p>\n<\/li>\n<li>\n<p>\u73af\u5f62\u7f13\u51b2\u533a&#xff1a;\u901a\u8fc7putIndex\/takeIndex\u5b9e\u73b0\u9ad8\u6548\u5faa\u73af\u961f\u5217<\/p>\n<\/li>\n<li>\n<p>\u8d44\u6e90\u6e05\u7406&#xff1a;\u53d6\u51fa\u5143\u7d20\u540e\u663e\u5f0f\u7f6enull\u907f\u514d\u5185\u5b58\u6cc4\u6f0f<\/p>\n<\/li>\n<h3>\u56db\u3001\u67b6\u6784\u53ef\u89c6\u5316\u5206\u6790<\/h3>\n<h4>\u56fe1&#xff1a;\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u7ebf\u7a0b\u4ea4\u4e92\u6d41\u7a0b<\/h4>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"500\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250811155926-689a135ea88db.png\" width=\"410\" \/><\/p>\n<p>\u56fe1&#xff1a;\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u4ea4\u4e92\u65f6\u5e8f\u56fe&#xff08;\u4f7f\u7528ReentrantLock\u7684\u6761\u4ef6\u901a\u77e5\u673a\u5236&#xff09;<\/p>\n<h4>\u56fe2&#xff1a;\u9501\u72b6\u6001\u8f6c\u6362\u673a\u5236<\/h4>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"491\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250811155927-689a135f302c9.png\" width=\"520\" \/><\/p>\n<p>\u56fe2&#xff1a;\u7ebf\u7a0b\u9501\u72b6\u6001\u8f6c\u6362\u56fe&#xff08;\u5c55\u793aReentrantLock\u4e0b\u7684\u7ebf\u7a0b\u72b6\u6001\u53d8\u8fc1&#xff09;<\/p>\n<h4>\u56fe3&#xff1a;\u5e76\u53d1\u6027\u80fd\u5bf9\u6bd4\u5206\u6790&#xff08;\u6d41\u7a0b\u56fe\u5f62\u5f0f&#xff09;<\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"481\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250811155927-689a135faea8c.png\" width=\"796\" \/><\/p>\n<p>\u56fe3&#xff1a;\u9501\u6027\u80fd\u5bf9\u6bd4\u6d41\u7a0b\u56fe&#xff08;\u4e0d\u540c\u7ebf\u7a0b\u6570\u4e0b\u7684\u6700\u4f18\u9501\u7b56\u7565&#xff09;<\/p>\n<\/p>\n<p>\u6027\u80fd\u5bf9\u6bd4\u8868\u683c&#xff1a;<\/p>\n<table>\n<tr>\u7ebf\u7a0b\u6570synchronized (ops\/ms)ReentrantLock\u975e\u516c\u5e73 (ops\/ms)ReentrantLock\u516c\u5e73 (ops\/ms)\u63a8\u8350\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>1<\/td>\n<td>850<\/td>\n<td>830<\/td>\n<td>820<\/td>\n<td>\u5355\u7ebf\u7a0b\u4efb\u52a1<\/td>\n<\/tr>\n<tr>\n<td>4<\/td>\n<td>3200<\/td>\n<td>3800<\/td>\n<td>3500<\/td>\n<td>Web\u670d\u52a1\u5668<\/td>\n<\/tr>\n<tr>\n<td>8<\/td>\n<td>4800<\/td>\n<td>7200<\/td>\n<td>6200<\/td>\n<td>\u6570\u636e\u5904\u7406<\/td>\n<\/tr>\n<tr>\n<td>16<\/td>\n<td>5200<\/td>\n<td>8500<\/td>\n<td>7800<\/td>\n<td>\u9ad8\u5e76\u53d1\u7cfb\u7edf<\/td>\n<\/tr>\n<tr>\n<td>32<\/td>\n<td>5100<\/td>\n<td>8200<\/td>\n<td>7700<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6027\u80fd\u5173\u952e\u53d1\u73b0&#xff1a;<\/p>\n<li>\n<p>\u4f4e\u5e76\u53d1\u573a\u666f(1-4\u7ebf\u7a0b)&#xff1a;<\/p>\n<ul>\n<li>\n<p>synchronized\u6709\u8f7b\u5fae\u4f18\u52bf&#xff08;&lt;5%\u6027\u80fd\u5dee\u5f02&#xff09;<\/p>\n<\/li>\n<li>\n<p>\u5f97\u76ca\u4e8eJVM\u5185\u7f6e\u4f18\u5316<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u4e2d\u9ad8\u5e76\u53d1\u573a\u666f(8&#043;\u7ebf\u7a0b)&#xff1a;<\/p>\n<\/li>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"455\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250811155928-689a136045ced.png\" width=\"726\" \/><\/p>\n<h4>\u56fe4&#xff1a;\u7cfb\u7edf\u67b6\u6784\u6f14\u8fdb<\/h4>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"500\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250811155928-689a1360964c2.png\" width=\"329\" \/><\/p>\n<p>\u56fe4&#xff1a;\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u67b6\u6784\u6f14\u8fdb\u6d41\u7a0b\u56fe&#xff08;\u4ece\u57fa\u7840\u5230\u9ad8\u7ea7\u7684\u5e76\u53d1\u63a7\u5236\u65b9\u6848\u53d1\u5c55&#xff09;<\/p>\n<h3>\u4e94\u3001\u6700\u4f73\u5b9e\u8df5\u4e0e\u9677\u9631\u89c4\u907f<\/h3>\n<h4>5.1 \u5fc5\u987b\u9075\u5faa\u7684\u9501\u4f7f\u7528\u8303\u5f0f<\/h4>\n<p>lock.lock();<br \/>\ntry {<br \/>\n    \/\/ \u4e34\u754c\u533a\u64cd\u4f5c<br \/>\n} finally {<br \/>\n    lock.unlock(); \/\/ \u786e\u4fdd\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\u90fd\u91ca\u653e\u9501<br \/>\n} <\/p>\n<h4>5.2 \u6761\u4ef6\u7b49\u5f85\u7684\u6b63\u786e\u6a21\u5f0f<\/h4>\n<p>while (!condition) { \/\/ \u5fc5\u987b\u4f7f\u7528\u5faa\u73af\u68c0\u67e5\u6761\u4ef6<br \/>\n    condition.await();<br \/>\n} <\/p>\n<p>\u539f\u56e0&#xff1a;\u9632\u6b62\u865a\u5047\u5524\u9192&#xff08;spurious wakeup&#xff09;\u5bfc\u81f4\u7684\u6761\u4ef6\u4e0d\u6ee1\u8db3<\/p>\n<h4>5.3 \u9ad8\u7ea7\u4f18\u5316\u6280\u5de7<\/h4>\n<li>\n<p>\u9501\u5206\u79bb\u6280\u672f&#xff1a;\u751f\u4ea7\u8005\u548c\u6d88\u8d39\u8005\u4f7f\u7528\u4e0d\u540c\u7684\u9501<\/p>\n<\/li>\n<li>\n<p>\u6279\u91cf\u4f20\u8f93&#xff1a;\u652f\u6301\u6279\u91cfput\/take\u51cf\u5c11\u9501\u7ade\u4e89<\/p>\n<\/li>\n<li>\n<p>\u7b49\u5f85\u8d85\u65f6&#xff1a;\u4f7f\u7528awaitNanos()\u907f\u514d\u6c38\u4e45\u963b\u585e<\/p>\n<\/li>\n<p>public boolean offer(T item, long timeout, TimeUnit unit)<br \/>\n    throws InterruptedException {<br \/>\n    long nanos &#061; unit.toNanos(timeout);<br \/>\n    lock.lockInterruptibly();<br \/>\n    try {<br \/>\n        while (count &#061;&#061; items.length) {<br \/>\n            if (nanos &lt;&#061; 0) return false;<br \/>\n            nanos &#061; notFull.awaitNanos(nanos); \/\/ \u9650\u65f6\u7b49\u5f85<br \/>\n        }<br \/>\n        \/\/ &#8230; \u6dfb\u52a0\u5143\u7d20<br \/>\n        return true;<br \/>\n    } finally {<br \/>\n        lock.unlock();<br \/>\n    }<br \/>\n} <\/p>\n<h4>5.4 \u6700\u4f73\u5b9e\u8df5\u51b3\u7b56\u6811<\/h4>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"491\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250811155928-689a1360c8a94.png\" width=\"570\" \/><\/p>\n<h3>\u603b\u7ed3&#xff1a;\u5e76\u53d1\u7f16\u7a0b\u7684\u827a\u672f\u4e0e\u54f2\u5b66<\/h3>\n<p>\u5728\u672c\u6587\u7684\u63a2\u7d22\u65c5\u7a0b\u4e2d&#xff0c;\u6211\u4eec\u4ece\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u8fd9\u4e2a\u7ecf\u5178\u95ee\u9898\u5207\u5165&#xff0c;\u6df1\u5165\u5256\u6790\u4e86ReentrantLock\u8fd9\u628aJava\u5e76\u53d1\u5229\u5668\u76f8\u8f83\u4e8e\u4f20\u7edfsynchronized\u7684\u5173\u952e\u4f18\u52bf\u3002\u901a\u8fc7Condition\u6761\u4ef6\u53d8\u91cf\u7684\u7cbe\u51c6\u63a7\u5236&#xff0c;\u6211\u4eec\u5b9e\u73b0\u4e86\u7ebf\u7a0b\u95f4\u7684\u9ad8\u6548\u534f\u4f5c&#xff0c;\u907f\u514d\u4e86\u7c97\u7c92\u5ea6\u540c\u6b65\u5e26\u6765\u7684\u6027\u80fd\u635f\u8017\u3002\u5728\u5b9e\u73b0\u8fc7\u7a0b\u4e2d&#xff0c;\u6211\u7279\u522b\u5f3a\u8c03\u4e86\u9501\u4f7f\u7528\u7684\u5b89\u5168\u8303\u5f0f\u2014\u2014\u59cb\u7ec8\u5728finally\u5757\u4e2d\u91ca\u653e\u9501&#xff0c;\u8fd9\u662f\u907f\u514d\u6b7b\u9501\u7684\u751f\u547d\u7ebf\u3002\u73af\u5f62\u7f13\u51b2\u533a\u7684\u8bbe\u8ba1\u5219\u5c55\u793a\u4e86\u5982\u4f55\u5c06\u6570\u636e\u7ed3\u6784\u4e0e\u5e76\u53d1\u63a7\u5236\u5b8c\u7f8e\u878d\u5408\u3002<\/p>\n<p>\u6211\u6df1\u77e5\u9ad8\u5e76\u53d1\u7cfb\u7edf\u5982\u540c\u7cbe\u5bc6\u949f\u8868&#xff0c;\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u662f\u54ac\u5408\u7684\u9f7f\u8f6e\u3002ReentrantLock\u63d0\u4f9b\u7684\u53ef\u4e2d\u65ad\u9501\u83b7\u53d6\u3001\u516c\u5e73\u6027\u9009\u62e9\u4ee5\u53ca\u591a\u6761\u4ef6\u53d8\u91cf\u652f\u6301&#xff0c;\u8ba9\u6211\u4eec\u80fd\u591f\u50cf\u949f\u8868\u5320\u4e00\u6837\u7cbe\u7ec6\u8c03\u6574\u6bcf\u4e2a\u9f7f\u8f6e\u7684\u4e92\u52a8\u5173\u7cfb\u3002\u800c\u53ef\u89c6\u5316\u56fe\u8868\u5219\u4ece\u65f6\u7a7a\u7ef4\u5ea6\u63ed\u793a\u4e86\u7ebf\u7a0b\u534f\u4f5c\u7684\u672c\u8d28\u89c4\u5f8b&#xff0c;\u8fd9\u4e9b\u56fe\u8868\u90fd\u662f\u6211\u5728\u5b9e\u9645\u67b6\u6784\u8bbe\u8ba1\u4e2d\u53cd\u590d\u9a8c\u8bc1\u8fc7\u7684\u6a21\u578b\u3002<\/p>\n<p>\u7279\u522b\u9700\u8981\u5f3a\u8c03\u7684\u662f&#xff0c;\u867d\u7136ReentrantLock\u63d0\u4f9b\u4e86\u66f4\u5f3a\u5927\u7684\u63a7\u5236\u80fd\u529b&#xff0c;\u4f46\u4e5f\u5e26\u6765\u4e86\u66f4\u9ad8\u7684\u590d\u6742\u5ea6\u3002\u6b63\u5982\u5e76\u53d1\u5927\u5e08Doug Lea\u6240\u8a00&#xff1a;&#034;\u80fd\u529b\u8d8a\u5927&#xff0c;\u8d23\u4efb\u8d8a\u5927&#034;\u3002\u5f00\u53d1\u8005\u5fc5\u987b\u5bf9\u9501\u7684\u4f5c\u7528\u57df\u3001\u6301\u6709\u65f6\u95f4\u548c\u6761\u4ef6\u8c13\u8bcd\u6709\u6e05\u6670\u7684\u8ba4\u8bc6&#xff0c;\u5426\u5219\u5f88\u5bb9\u6613\u9677\u5165\u96be\u4ee5\u8bca\u65ad\u7684\u5e76\u53d1\u9677\u9631\u3002\u5efa\u8bae\u5728\u590d\u6742\u7cfb\u7edf\u4e2d\u914d\u5408\u4f7f\u7528JUC\u5305\u4e2d\u7684CountDownLatch\u3001CyclicBarrier\u7b49\u9ad8\u7ea7\u5de5\u5177&#xff0c;\u6784\u5efa\u591a\u5c42\u6b21\u7684\u5e76\u53d1\u9632\u5fa1\u4f53\u7cfb\u3002<\/p>\n<p>\u6700\u540e&#xff0c;\u968f\u7740Java\u7248\u672c\u7684\u6f14\u8fdb&#xff0c;VarHandle\u548cProject Loom\u7b49\u65b0\u6280\u672f\u6b63\u5728\u91cd\u5851\u5e76\u53d1\u7f16\u7a0b\u7684\u683c\u5c40\u3002\u4f46\u65e0\u8bba\u6280\u672f\u5982\u4f55\u53d1\u5c55&#xff0c;\u7406\u89e3\u8fd9\u4e9b\u57fa\u7840\u5e76\u53d1\u6a21\u578b\u7684\u672c\u8d28&#xff0c;\u5c06\u5e2e\u52a9\u6211\u4eec\u5728\u65b0\u6280\u672f\u6d6a\u6f6e\u4e2d\u4fdd\u6301\u6838\u5fc3\u7ade\u4e89\u529b\u3002\u5e0c\u671b\u672c\u6587\u5206\u4eab\u7684\u65b9\u6848\u80fd\u6210\u4e3a\u4f60\u89e3\u51b3\u5b9e\u9645\u5e76\u53d1\u95ee\u9898\u7684\u5229\u5668&#xff0c;\u4e5f\u671f\u5f85\u5728\u8bc4\u8bba\u533a\u770b\u5230\u4f60\u7684\u5b9e\u6218\u7ecf\u9a8c\u548c\u521b\u65b0\u601d\u8def\u3002<\/p>\n<p>\u53c2\u8003\u94fe\u63a5&#xff1a;<\/p>\n<li>\n<p>Java\u5e76\u53d1\u7f16\u7a0b\u5b9e\u6218<\/p>\n<\/li>\n<li>\n<p>ReentrantLock\u5b98\u65b9\u6587\u6863<\/p>\n<\/li>\n<li>\n<p>Java\u5185\u5b58\u6a21\u578b\u8be6\u89e3<\/p>\n<\/li>\n<li>\n<p>\u9ad8\u6027\u80fd\u961f\u5217\u8bbe\u8ba1\u6a21\u5f0f<\/p>\n<\/li>\n<li>\n<p>\u5e76\u53d1\u7f16\u7a0b\u907f\u5751\u6307\u5357<\/p>\n<\/li>\n<p>&#x1f31f; \u6211\u662f \u52b1\u5fd7\u6210\u4e3a\u7cd5\u624b &#xff0c;\u611f\u8c22\u4f60\u4e0e\u6211\u5171\u5ea6\u8fd9\u6bb5\u6280\u672f\u65f6\u5149&#xff01;<\/p>\n<p>\u2728 \u5982\u679c\u8fd9\u7bc7\u6587\u7ae0\u4e3a\u4f60\u5e26\u6765\u4e86\u542f\u53d1&#xff1a; \u2705 \u3010\u6536\u85cf\u3011\u5173\u952e\u77e5\u8bc6\u70b9&#xff0c;\u6253\u9020\u4f60\u7684\u6280\u672f\u6b66\u5668\u5e93 &#x1f4a1; \u3010\u8bc4\u8bba\u3011\u7559\u4e0b\u601d\u8003\u8f68\u8ff9&#xff0c;\u4e0e\u540c\u884c\u8005\u78b0\u649e\u667a\u6167\u706b\u82b1 &#x1f680; \u3010\u5173\u6ce8\u3011\u6301\u7eed\u83b7\u53d6\u524d\u6cbf\u6280\u672f\u89e3\u6790\u4e0e\u5b9e\u6218\u5e72\u8d27<\/p>\n<p>&#x1f30c; \u6280\u672f\u63a2\u7d22\u6c38\u65e0\u6b62\u5883&#xff0c;\u8ba9\u6211\u4eec\u7ee7\u7eed\u5728\u4ee3\u7801\u7684\u5b87\u5b99\u4e2d&#xff1a; \u2022 \u7528\u4f18\u96c5\u7684\u7b97\u6cd5\u7ed8\u5236\u661f\u56fe \u2022 \u4ee5\u4e25\u8c28\u7684\u903b\u8f91\u642d\u5efa\u6865\u6881 \u2022 \u8ba9\u521b\u65b0\u7684\u601d\u7ef4\u7167\u4eae\u524d\u8def &#x1f4e1; \u4fdd\u6301\u8fde\u63a5&#xff0c;\u6211\u4eec\u4e0b\u6b21\u592a\u7a7a\u89c1&#xff01;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb23\u6b21\u3002\u4f7f\u7528ReentrantLock\u5b9e\u73b0\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u6a21\u578b<\/p>\n","protected":false},"author":2,"featured_media":53063,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,190,56,5345],"topic":[],"class_list":["post-53070","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-java","tag-190","tag-56"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Java\u591a\u7ebf\u7a0b\u5e76\u53d1\u63a7\u5236\uff1a\u4f7f\u7528ReentrantLock\u5b9e\u73b0\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u6a21\u578b - \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\/53070.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java\u591a\u7ebf\u7a0b\u5e76\u53d1\u63a7\u5236\uff1a\u4f7f\u7528ReentrantLock\u5b9e\u73b0\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb23\u6b21\u3002\u4f7f\u7528ReentrantLock\u5b9e\u73b0\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u6a21\u578b\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/53070.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-11T15:59:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250811155923-689a135b8ec43.png\" \/>\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=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/53070.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/53070.html\",\"name\":\"Java\u591a\u7ebf\u7a0b\u5e76\u53d1\u63a7\u5236\uff1a\u4f7f\u7528ReentrantLock\u5b9e\u73b0\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-11T15:59:30+00:00\",\"dateModified\":\"2025-08-11T15:59:30+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/53070.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/53070.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/53070.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\u591a\u7ebf\u7a0b\u5e76\u53d1\u63a7\u5236\uff1a\u4f7f\u7528ReentrantLock\u5b9e\u73b0\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u6a21\u578b\"}]},{\"@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":"Java\u591a\u7ebf\u7a0b\u5e76\u53d1\u63a7\u5236\uff1a\u4f7f\u7528ReentrantLock\u5b9e\u73b0\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u6a21\u578b - \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\/53070.html","og_locale":"zh_CN","og_type":"article","og_title":"Java\u591a\u7ebf\u7a0b\u5e76\u53d1\u63a7\u5236\uff1a\u4f7f\u7528ReentrantLock\u5b9e\u73b0\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb23\u6b21\u3002\u4f7f\u7528ReentrantLock\u5b9e\u73b0\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u6a21\u578b","og_url":"https:\/\/www.wsisp.com\/helps\/53070.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-11T15:59:30+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250811155923-689a135b8ec43.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/53070.html","url":"https:\/\/www.wsisp.com\/helps\/53070.html","name":"Java\u591a\u7ebf\u7a0b\u5e76\u53d1\u63a7\u5236\uff1a\u4f7f\u7528ReentrantLock\u5b9e\u73b0\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-11T15:59:30+00:00","dateModified":"2025-08-11T15:59:30+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/53070.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/53070.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/53070.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Java\u591a\u7ebf\u7a0b\u5e76\u53d1\u63a7\u5236\uff1a\u4f7f\u7528ReentrantLock\u5b9e\u73b0\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u6a21\u578b"}]},{"@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\/53070","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=53070"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/53070\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/53063"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=53070"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=53070"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=53070"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=53070"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}