{"id":161528,"date":"2020-09-15T04:28:39","date_gmt":"2020-09-14T20:28:39","guid":{"rendered":"http:\/\/4563.org\/?p=161528"},"modified":"2020-09-15T04:28:39","modified_gmt":"2020-09-14T20:28:39","slug":"jdk-%e9%87%8c%e9%9d%a2%e7%9a%84%e8%87%aa%e5%b8%a6%e7%9a%84%e7%ba%bf%e7%a8%8b%e6%b1%a0%e4%b8%ba%e5%95%a5%e9%83%bd%e4%b8%8d%e6%94%b9%e4%b8%80%e4%b8%8b%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=161528","title":{"rendered":"JDK \u91cc\u9762\u7684\u81ea\u5e26\u7684\u7ebf\u7a0b\u6c60\u4e3a\u5565\u90fd\u4e0d\u6539\u4e00\u4e0b\u5b9e\u73b0?"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  JDK \u91cc\u9762\u7684\u81ea\u5e26\u7684\u7ebf\u7a0b\u6c60\u4e3a\u5565\u90fd\u4e0d\u6539\u4e00\u4e0b\u5b9e\u73b0?               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : huntcool001 <\/span>  <span><i><\/i> 5<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>RT, \u8bf4\u7684\u5c31\u662f Executors.newFixedThreadPool()\u7684\u90a3\u51e0\u4e2a\u5b9e\u73b0.<\/p>\n<p>\u8981\u4e48\u5c31\u662f\u961f\u5217\u662f\u65e0\u754c\u7684(newFixedThreadPool,newSingleThreadExecutor)<\/p>\n<p>\u8981\u4e48\u5c31\u662f\u7ebf\u7a0b\u6c60\u6570\u91cf\u6ca1\u6709\u4e0a\u9650(newCachedThreadPool)<\/p>\n<p>\u7ed3\u679c\u5c31\u662f\u751f\u4ea7\u91cc\u5927\u5bb6\u57fa\u672c\u90fd\u4e0d\u4f1a\u7528 Executors \u91cc\u7684\u8fd9\u51e0\u4e2a\u5b9e\u73b0,\u4e0d\u7136\u633a\u5bb9\u6613\u5185\u5b58\u7206\u6389. \u4f30\u8ba1\u4e0d\u5c11\u4eba\u90fd\u9047\u5230\u8fc7\u8fd9\u4e2a\u95ee\u9898.\u6240\u4ee5\u963f\u91cc\u7684\u89c4\u8303\u91cc\u8981\u6c42\u90fd\u662f\u81ea\u5df1\u7528 ThreadPoolExecutor \u5b9e\u73b0\u4e00\u4e2a,\u653e\u4e00\u4e2a\u6709\u754c\u961f\u5217\u8fdb\u53bb.<\/p>\n<p>\u6211\u7684\u95ee\u9898\u5c31\u662f,\u4e3a\u5565 JDK \u7684\u7ef4\u62a4\u8005\u4e0d\u591a\u52a0\u4e2a\u6784\u9020\u51fd\u6570,\u5141\u8bb8\u6307\u5b9a\u961f\u5217\u4e0a\u9650\u7684?<\/p>\n<p>\u6bd4\u5982\u8bf4 Executors.newFixedThreadPool(int queueCapcity)<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>12<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3491016\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : smallyu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             ?                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3491017\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : codebigbang <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u56e0\u4e3a\u5f00\u53d1\u8005\u8981\u4fdd\u8bc1\u65b9\u6cd5\u9002\u7528\u4e8e\u5927\u90e8\u5206\u4eba\uff0c\u6709\u7279\u6b8a\u9700\u6c42\u7684\u53ef\u4ee5\u6309\u7167\u6e90\u7801\u81ea\u5df1\u4fee\u6539                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3491018\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : EminemW <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             ?\u600e\u4e48\u6211\u7684\u7ebf\u7a0b\u6c60\u53ef\u4ee5\u4f20\u6700\u5927\u7ebf\u7a0b\u6570                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3491019\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : hodur <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             LinkedBlockingQueue \u662f\u65e0\u754c\u7684\u5417                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3491020\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : anthow <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u65b9\u4fbf\u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3491021\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : youxiachai <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             LinkedBlockingQueue \u6211\u767d\u7528\u4e86?                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3491022\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : youxiachai <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u96be\u602a\u6211\u770b\u8d77\u6765\u8fd9\u4e48\u602a&#8230;.<br \/>Executors.newFixedThreadPool(int queueCapcity)<br \/>\u539f\u6765\u662f android \u624d\u652f\u6301?                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3491023\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : youxiachai <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u9519\u4e86..\u5ffd\u7565..\u5e94\u8be5\u6709\u624d\u5bf9\u554a&#8230;. lz \u7528\u7684 jdk \u7248\u672c\u662f\u591a\u5c11,\u4e3a\u5565\u4f1a\u6ca1\u6709..                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3491024\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xiaofan2 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             lz \u7684\u65e0\u754c\u7684\u610f\u601d\u662f\u5982\u4f55\u4e0d\u4f20\u53c2\u6570\u9ed8\u8ba4\u7684\u53c2\u6570\u662f Integer.MAX_VALUE \u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3491025\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wysnylc <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             Executors.newWorkStealingPool(200)<br \/>\u8bb0\u5f97\u7ecf\u5e38\u66f4\u65b0\u4e0b\u81ea\u5df1\u7684 jdk \u548c\u6280\u672f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3491026\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : huntcool001 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @youxiachai <\/p>\n<p>https:\/\/docs.oracle.com\/en\/java\/javase\/15\/docs\/api\/java.base\/java\/util\/concurrent\/Executors.html<\/p>\n<p>JDK15 \u7684\u6587\u6863, \u6ca1\u6709 Executors.newFixedThreadPool(int queueCapcity)                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3491027\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zhady009 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @wysnylc \u8fd9\u4e2a api \u7684\u5165\u53c2\u4e0d\u662f\u961f\u5217\u5bb9\u91cf\u5427                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>JDK \u91cc\u9762\u7684\u81ea\u5e26\u7684\u7ebf\u7a0b\u6c60\u4e3a\u5565\u90fd\u4e0d&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/161528"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=161528"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/161528\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=161528"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=161528"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=161528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}