{"id":10006121,"date":"2022-08-05T18:32:43","date_gmt":"2022-08-05T10:32:43","guid":{"rendered":"https:\/\/ityet.com\/?p=10006121"},"modified":"2022-08-05T18:32:43","modified_gmt":"2022-08-05T10:32:43","slug":"%e3%80%90java%e9%9d%a2%e8%af%95%e3%80%91%e8%ae%b2%e4%b8%8b%e7%ba%bf%e7%a8%8b%e6%b1%a0%e7%9a%84%e7%ba%bf%e7%a8%8b%e5%9b%9e%e6%94%b6","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10006121","title":{"rendered":"\u3010Java\u9762\u8bd5\u3011\u8bb2\u4e0b\u7ebf\u7a0b\u6c60\u7684\u7ebf\u7a0b\u56de\u6536"},"content":{"rendered":"<blockquote>\n<p>\u5927\u5bb6\u597d\uff0c\u6211\u662fMic\uff0c\u4e00\u4e2a\u5de5\u4f5c\u4e8614\u5e74\u7684Java\u7a0b\u5e8f\u5458\u3002<\/p>\n<p>\u6700\u8fd1\u5f88\u591a\u5c0f\u4f19\u4f34\u79c1\u4fe1\u6211\uff0c\u8ba9\u6211\u8bf4\u4e00\u4e9b\u7ebf\u7a0b\u6c60\u76f8\u5173\u7684\u95ee\u9898\u3002<\/p>\n<p>\u7ebf\u7a0b\u6c60\u8fd9\u4e2a\u65b9\u5411\u8003\u5bdf\u7684\u70b9\u8fd8\u633a\u591a\u7684\uff0c\u5982\u679c\u53ea\u662f\u9760\u5237\u9762\u8bd5\u9898<\/p>\n<p>\u9762\u8bd5\u5b98\u5f88\u5bb9\u6613\u5c31\u80fd\u8bc6\u522b\u51fa\u6765\uff0c\u6211\u968f\u4fbf\u4e3e\u51e0\u4e2a\u3002<\/p>\n<ul>\n<li>\u7ebf\u7a0b\u6c60\u662f\u5982\u4f55\u5b9e\u73b0\u7ebf\u7a0b\u7684\u56de\u6536\u7684<\/li>\n<li>\u6838\u5fc3\u7ebf\u7a0b\u662f\u5426\u80fd\u591f\u56de\u6536<\/li>\n<li>\u5f53\u8c03\u7528\u7ebf\u7a0b\u6c60\u7684shutdown\u65b9\u6cd5\uff0c\u4f1a\u53d1\u751f\u4ec0\u4e48\uff1f<\/li>\n<\/ul>\n<p>\u9762\u8bd5\u4e00\u5b9a\u662f\u8fde\u73af\u95ee\uff0c\u4ece\u800c\u786e\u5b9a\u6c42\u804c\u8005\u5bf9\u8fd9\u4e2a\u9886\u57df\u7684\u7406\u89e3\u7a0b\u5ea6\u3002<\/p>\n<p>\u5173\u4e8e\u7ebf\u7a0b\u6c60\u56de\u6536\u76f8\u5173\u7684\u95ee\u9898\uff0c\u9ad8\u624b\u90e8\u5206\u7684\u56de\u7b54\u6211\u6574\u7406\u5230\u4e86\u4e00\u4e2a20W\u5b57\u7684\u9762\u8bd5\u6587\u6863\u91cc\u9762\u5927\u5bb6\u53ef\u4ee5\u79c1\u4fe1\u6211\u9886\u53d6\u3002<\/p>\n<p>\u4e0b\u9762\u770b\u770b\u9ad8\u624b\u7684\u56de\u7b54<\/p>\n<\/blockquote>\n<h2>\u9ad8\u624b\uff1a<\/h2>\n<p>\u9996\u5148\uff0c\u7ebf\u7a0b\u6c60\u91cc\u9762\u5206\u4e3a\u6838\u5fc3\u7ebf\u7a0b\u548c\u975e\u6838\u5fc3\u7ebf\u7a0b\u3002<\/p>\n<p>\u6838\u5fc3\u7ebf\u7a0b\u662f\u5e38\u9a7b\u5728\u7ebf\u7a0b\u6c60\u91cc\u9762\u7684\u5de5\u4f5c\u7ebf\u7a0b\uff0c\u5b83\u6709\u4e24\u79cd\u65b9\u5f0f\u521d\u59cb\u5316\u3002<\/p>\n<ul>\n<li>\u5411\u7ebf\u7a0b\u6c60\u91cc\u9762\u6dfb\u52a0\u4efb\u52a1\u7684\u65f6\u5019\uff0c\u88ab\u52a8\u521d\u59cb\u5316<\/li>\n<li>\u4e3b\u52a8\u8c03\u7528<code>prestartAllCoreThreads<\/code>\u65b9\u6cd5<\/li>\n<\/ul>\n<p>\u5f53\u7ebf\u7a0b\u6c60\u91cc\u9762\u7684\u961f\u5217\u6ee1\u4e86\u7684\u60c5\u51b5\u4e0b\uff0c\u4e3a\u4e86\u589e\u52a0\u7ebf\u7a0b\u6c60\u7684\u4efb\u52a1\u5904\u7406\u80fd\u529b\u3002<\/p>\n<p>\u7ebf\u7a0b\u6c60\u4f1a\u589e\u52a0\u975e\u6838\u5fc3\u7ebf\u7a0b\u3002<\/p>\n<p>\u6838\u5fc3\u7ebf\u7a0b\u548c\u975e\u6838\u5fc3\u7ebf\u7a0b\u7684\u6570\u91cf\uff0c\u662f\u5728\u6784\u9020\u7ebf\u7a0b\u6c60\u7684\u65f6\u5019\u8bbe\u7f6e\u7684\uff0c\u4e5f\u53ef\u4ee5\u52a8\u6001\u8fdb\u884c\u66f4\u6539\u3002<\/p>\n<p>\u7531\u4e8e\u975e\u6838\u5fc3\u7ebf\u7a0b\u662f\u4e3a\u4e86\u89e3\u51b3\u4efb\u52a1\u8fc7\u591a\u7684\u65f6\u5019\u4e34\u65f6\u589e\u52a0\u7684\uff0c\u6240\u4ee5\u5f53\u4efb\u52a1\u5904\u7406\u5b8c\u6210\u540e\uff0c\u5de5\u4f5c\u7ebf\u7a0b\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u7684\u65f6\u5019\uff0c\u5c31\u9700\u8981\u56de\u6536\u3002<\/p>\n<p>\u56e0\u4e3a\u6240\u6709\u5de5\u4f5c\u7ebf\u7a0b\u90fd\u662f\u4ece\u963b\u585e\u961f\u5217\u4e2d\u53bb\u83b7\u53d6\u8981\u6267\u884c\u7684\u4efb\u52a1\uff0c\u6240\u4ee5\u53ea\u8981\u5728\u4e00\u5b9a\u65f6\u95f4\u5185\uff0c\u963b\u585e\u961f\u5217\u6ca1\u6709\u4efb\u4f55\u53ef\u4ee5\u5904\u7406\u7684\u4efb\u52a1\uff0c\u90a3\u8fd9\u4e2a\u7ebf\u7a0b\u5c31\u53ef\u4ee5\u7ed3\u675f\u4e86\u3002<\/p>\n<p>\u8fd9\u4e2a\u529f\u80fd\u662f\u901a\u8fc7\u963b\u585e\u961f\u5217\u91cc\u9762\u7684poll\u65b9\u6cd5\u6765\u5b8c\u6210\u7684\u3002\u8fd9\u4e2a\u65b9\u6cd5\u63d0\u4f9b\u4e86\u8d85\u65f6\u65f6\u95f4\u548c\u8d85\u65f6\u65f6\u95f4\u5355\u4f4d\u8fd9\u4e24\u4e2a\u53c2\u6570\u5f53\u8d85\u8fc7\u6307\u5b9a\u65f6\u95f4\u6ca1\u6709\u83b7\u53d6\u5230\u4efb\u52a1\u7684\u65f6\u5019\uff0cpoll\u65b9\u6cd5\u8fd4\u56denull\uff0c\u4ece\u800c\u7ec8\u6b62\u5f53\u524d\u7ebf\u7a0b\u5b8c\u6210\u7ebf\u7a0b\u56de\u6536\u3002<\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u7ebf\u7a0b\u6c60\u53ea\u4f1a\u56de\u6536\u975e\u6838\u5fc3\u7ebf\u7a0b\uff0c\u5982\u679c\u5e0c\u671b\u6838\u5fc3\u7ebf\u7a0b\u4e5f\u8981\u56de\u6536\uff0c\u53ef\u4ee5\u8bbe\u7f6eallowCoreThreadTimeOut\u8fd9\u4e2a\u5c5e\u6027\u4e3atrue\uff0c\u4e00\u822c\u60c5\u51b5\u4e0b\u6211\u4eec\u4e0d\u4f1a\u53bb\u56de\u6536\u6838\u5fc3\u7ebf\u7a0b\u3002<\/p>\n<p>\u56e0\u4e3a\u7ebf\u7a0b\u6c60\u672c\u8eab\u5c31\u662f\u5b9e\u73b0\u7ebf\u7a0b\u7684\u590d\u7528\uff0c\u800c\u4e14\u8fd9\u4e9b\u6838\u5fc3\u7ebf\u7a0b\u5728\u6ca1\u6709\u4efb\u52a1\u8981\u5904\u7406\u7684\u65f6\u5019\u662f\u5904\u4e8e\u963b\u585e\u72b6\u6001\u5e76\u6ca1\u6709\u5360\u7528CPU\u8d44\u6e90\u3002<\/p>\n<h2>\u603b\u7ed3<\/h2>\n<p>\u5173\u4e8e\u7ebf\u7a0b\u6c60\uff0c\u662f\u6bcf\u4e00\u4e2aJava\u7a0b\u5e8f\u5458\u5fc5\u987b\u8981\u6df1\u5ea6\u638c\u63e1\u7684\u5185\u5bb9\u3002<\/p>\n<p>\u5b83\u5f88\u91cd\u8981\uff0c\u5728\u6211\u4eec\u7684\u5e94\u7528\u7cfb\u7edf\u4e2d\uff0c\u65e0\u5904\u4e0d\u5728\u4f53\u73b0\u7ebf\u7a0b\u3002<\/p>\n<p>\u5305\u62ec\u5728\u5e94\u7528\u5f00\u53d1\u4e2d\uff0c\u4e5f\u96be\u514d\u4f1a\u7528\u5230\u7ebf\u7a0b\u6c60\u3002<\/p>\n<p>\u638c\u63e1\u597d\u5b83\u80fd\u591f\u5199\u51fa\u66f4\u52a0\u5065\u58ee\u6027\u548c\u7a33\u5b9a\u6027\u7684\u7a0b\u5e8f\u3002<\/p>\n<p>\u5927\u5bb6\u8bb0\u5f97\u70b9\u8d5e\u3001\u6536\u85cf\u52a0\u5173\u6ce8<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVcZhSx\" alt=\"file\" title=\"file\" loading=\"lazy\"><\/p>\n<blockquote><p>\u7248\u6743\u58f0\u660e\uff1a\u672c\u535a\u5ba2\u6240\u6709\u6587\u7ae0\u9664\u7279\u522b\u58f0\u660e\u5916\uff0c\u5747\u91c7\u7528 CC BY-NC-SA 4.0 \u8bb8\u53ef\u534f\u8bae\u3002\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u6765\u81ea <code>Mic\u5e26\u4f60\u5b66\u67b6\u6784<\/code>\uff01<br \/>\u5982\u679c\u672c\u7bc7\u6587\u7ae0\u5bf9\u60a8\u6709\u5e2e\u52a9\uff0c\u8fd8\u8bf7\u5e2e\u5fd9\u70b9\u4e2a\u5173\u6ce8\u548c\u8d5e\uff0c\u60a8\u7684\u575a\u6301\u662f\u6211\u4e0d\u65ad\u521b\u4f5c\u7684\u52a8\u529b\u3002\u6b22\u8fce\u5173\u6ce8\u540c\u540d\u5fae\u4fe1\u516c\u4f17\u53f7\u83b7\u53d6\u66f4\u591a\u6280\u672f\u5e72\u8d27\uff01<\/p><\/blockquote>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000042274807\">https:\/\/segmentfault.com\/a\/1190000042274807<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5927\u5bb6\u597d\uff0c\u6211\u662fMic\uff0c\u4e00\u4e2a\u5de5\u4f5c\u4e8614\u5e74\u7684Java\u7a0b\u5e8f\u5458\u3002 \u6700\u8fd1\u5f88\u591a\u5c0f\u4f19\u4f34\u79c1\u4fe1\u6211\uff0c\u8ba9\u6211\u8bf4\u4e00\u4e9b\u7ebf\u7a0b\u6c60\u76f8\u5173\u7684\u95ee\u9898\u3002 \u7ebf [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-10006121","post","type-post","status-publish","format-standard","hentry"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10006121"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006121\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10006121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10006121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10006121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}