{"id":1339,"date":"2023-05-28T10:14:42","date_gmt":"2023-05-28T02:14:42","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/?p=1339"},"modified":"2023-05-28T10:14:42","modified_gmt":"2023-05-28T02:14:42","slug":"%e9%9d%a2%e8%af%95%e5%ae%98-%e9%98%bb%e5%a1%9e%e9%98%9f%e5%88%97%e7%9a%84%e5%ba%95%e5%b1%82%e5%ae%9e%e7%8e%b0%e6%9c%89%e4%ba%86%e8%a7%a3%e8%bf%87%e5%90%97-%e8%af%b4%e8%af%b4%e7%9c%8b","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/java\/%e9%9d%a2%e8%af%95%e5%ae%98-%e9%98%bb%e5%a1%9e%e9%98%9f%e5%88%97%e7%9a%84%e5%ba%95%e5%b1%82%e5%ae%9e%e7%8e%b0%e6%9c%89%e4%ba%86%e8%a7%a3%e8%bf%87%e5%90%97-%e8%af%b4%e8%af%b4%e7%9c%8b\/","title":{"rendered":"\u9762\u8bd5\u5b98: \u963b\u585e\u961f\u5217\u7684\u5e95\u5c42\u5b9e\u73b0\u6709\u4e86\u89e3\u8fc7\u5417? \u8bf4\u8bf4\u770b"},"content":{"rendered":"<div class=\"wxsyncmain\">\n<section style=\"font-size: 16px; color: black; padding: 0 10px; word-spacing: 0px; word-break: break-word; word-wrap: break-word; text-align: left; line-height: 1.25; letter-spacing: 2px; background-image: linear-gradient(90deg, rgba(50, 0, 0, 0.05) 3%, rgba(0, 0, 0, 0) 3%), linear-gradient(360deg, rgba(50, 0, 0, 0.05) 3%, rgba(0, 0, 0, 0) 3%); background-size: 20px 20px; background-position: center center; font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, 'PingFang SC', Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;\" data-tool=\"mdnice\u7f16\u8f91\u5668\" data-website=\"https:\/\/www.mdnice.com\">\n<h1 style=\"margin-top: 30px; margin-bottom: 15px; padding: 0px; font-weight: bold; color: black; font-size: 25px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><span style=\"display: inline-block; font-weight: bold; color: #773098;\">\u9762\u8bd5\u5b98: \u963b\u585e\u961f\u5217\u7684\u5e95\u5c42\u5b9e\u73b0\u6709\u4e86\u89e3\u8fc7\u5417? \u8bf4\u8bf4\u770b<\/span><\/h1>\n<h2 style=\"margin-top: 30px; margin-bottom: 15px; padding: 0px; font-weight: bold; color: black; font-size: 22px; text-align: left; margin: 20px 10px 0px 0px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><span style=\"font-size: 18px; font-weight: bold; display: inline-block; padding-left: 10px; border-left: 5px solid #916dd5;\">\u524d\u8a00<\/span><\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 10px 0px; letter-spacing: 2px; font-size: 14px; word-spacing: 2px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u76ee\u524d\u6b63\u5728\u51fa\u4e00\u4e2a<code style=\"font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; background-color: rgba(27,31,35,.05); font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #916dd5; font-weight: bolder; background: none;\">Java\u591a\u7ebf\u7a0b\u4e13\u9898<\/code>\u957f\u671f\u7cfb\u5217\u6559\u7a0b\uff0c\u4ece\u5165\u95e8\u5230\u8fdb\u9636\u542b<code style=\"font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; background-color: rgba(27,31,35,.05); font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #916dd5; font-weight: bolder; background: none;\">\u6e90\u7801\u89e3\u8bfb<\/code>, \u7bc7\u5e45\u4f1a\u8f83\u591a, \u559c\u6b22\u7684\u8bdd\uff0c\u7ed9\u4e2a\u5173\u6ce8\u2764\ufe0f ~<\/p>\n<section class=\"mp_profile_iframe_wrp\"><\/section>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 10px 0px; letter-spacing: 2px; font-size: 14px; word-spacing: 2px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u672c\u8282\u4ee5<code style=\"font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; background-color: rgba(27,31,35,.05); font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #916dd5; font-weight: bolder; background: none;\">ArrayBlockingQueue<\/code>\u4e3a\u4f8b, \u5e26\u5927\u5bb6\u770b\u4e0b\u963b\u585e\u961f\u5217\u662f\u5982\u4f55\u5b9e\u73b0\uff0c\u4e00\u8d77\u6765\u770b\u4e0b\u5427~<\/p>\n<h2 style=\"margin-top: 30px; margin-bottom: 15px; padding: 0px; font-weight: bold; color: black; font-size: 22px; text-align: left; margin: 20px 10px 0px 0px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><span style=\"font-size: 18px; font-weight: bold; display: inline-block; padding-left: 10px; border-left: 5px solid #916dd5;\">ArrayBlockingQueue \u6e90\u7801\u5206\u6790<\/span><\/h2>\n<h3 style=\"margin-top: 30px; margin-bottom: 15px; padding: 0px; color: black; font-size: 16px; font-weight: bold; text-align: center;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><span style=\"border-bottom: 2px solid #d89cf6;\">\u6784\u9020\u51fd\u6570<\/span><\/h3>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 10px 0px; letter-spacing: 2px; font-size: 14px; word-spacing: 2px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u540c\u6837\u7684\uff0c\u6211\u4eec\u5148\u4ece\u5b83\u7684\u6784\u9020\u51fd\u6570\u770b\u8d77<\/p>\n<pre style=\"margin-top: 10px; margin-bottom: 10px; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><code style=\"overflow-x: auto; padding: 16px; color: #abb2bf; display: -webkit-box; font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; font-size: 12px; -webkit-overflow-scrolling: touch; padding-top: 15px; background: #282c34; border-radius: 5px;\">\u00a0\u00a0<span style=\"line-height: 26px;\"><span style=\"color: #c678dd; line-height: 26px;\">public<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">void<\/span>\u00a0<span style=\"color: #61aeee; line-height: 26px;\">put<\/span><span style=\"line-height: 26px;\">(E\u00a0e)<\/span>\u00a0<span style=\"color: #c678dd; line-height: 26px;\">throws<\/span>\u00a0InterruptedException\u00a0<\/span>{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0checkNotNull(e);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">final<\/span>\u00a0ReentrantLock\u00a0lock\u00a0=\u00a0<span style=\"color: #c678dd; line-height: 26px;\">this<\/span>.lock;\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0lock.lockInterruptibly();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">try<\/span>\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0\u5982\u679c\u5143\u7d20\u6ee1\u4e86\u00a0\u5c31\u963b\u585e<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #c678dd; line-height: 26px;\">while<\/span>\u00a0(count\u00a0==\u00a0items.length)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0notFull.await();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<span style=\"color: #5c6370; font-style: italic; line-height: 26px;\">\/\/\u00a0\u5426\u5219\u5165\u5217\u00a0\u00a0\u00a0\u00a0<\/span>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0enqueue(e);\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0<span style=\"color: #c678dd; line-height: 26px;\">finally<\/span>\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0lock.unlock();\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0}\n<\/code><\/pre>\n<h2 style=\"margin-top: 30px; margin-bottom: 15px; padding: 0px; font-weight: bold; color: black; font-size: 22px; text-align: left; margin: 20px 10px 0px 0px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\"><span style=\"font-size: 18px; font-weight: bold; display: inline-block; padding-left: 10px; border-left: 5px solid #916dd5;\">\u7ed3\u675f\u8bed<\/span><\/h2>\n<p style=\"padding-top: 8px; padding-bottom: 8px; line-height: 26px; color: black; margin: 10px 0px; letter-spacing: 2px; font-size: 14px; word-spacing: 2px;\" data-tool=\"mdnice\u7f16\u8f91\u5668\">\u672c\u8282\u4e3b\u8981\u7ed9\u5927\u5bb6\u8bb2\u4e86<code style=\"font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; background-color: rgba(27,31,35,.05); font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #916dd5; font-weight: bolder; background: none;\">ArrayBlockingQueue<\/code>\u7684\u6e90\u7801\u5b9e\u73b0\uff0c\u5b83\u7684\u6e90\u7801\u76f8\u5bf9\u7b80\u5355\u4e00\u4e9b, \u5927\u5bb6\u53ef\u4ee5\u6839\u636e\u672c\u8282\u770b\u4e0b<code style=\"font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; background-color: rgba(27,31,35,.05); font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #916dd5; font-weight: bolder; background: none;\">BlockingQueue<\/code>\u5176\u5b83\u7684\u5b9e\u73b0\u7c7b\u3002\u4e0b\u4e00\u8282, \u5e26\u5927\u5bb6\u5b66\u4e60\u4e00\u4e0b<code style=\"font-size: 14px; word-wrap: break-word; padding: 2px 4px; border-radius: 4px; margin: 0 2px; background-color: rgba(27,31,35,.05); font-family: Operator Mono, Consolas, Monaco, Menlo, monospace; word-break: break-all; color: #916dd5; font-weight: bolder; background: none;\">\u5e76\u53d1\u5bb9\u5668<\/code> ~<\/p>\n<\/section>\n<p style=\"text-align: center; margin-bottom: 0em;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528042145299.jpeg\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\" data-galleryid=\"\" data-ratio=\"1.2792553191489362\" data-s=\"300,640\" data-type=\"jpeg\" data-w=\"752\" \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528042145299.jpeg\" data-galleryid=\"\" data-ratio=\"1.2792553191489362\" data-s=\"300,640\" data-type=\"jpeg\" data-w=\"752\" \/><\/noscript><\/p>\n<blockquote><p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7: \u7a0b\u5e8f\u5458\u76ae\u5361\u79cb<\/p><\/blockquote>\n<\/div>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>\u9762\u8bd5\u5b98: \u963b\u585e\u961f\u5217\u7684\u5e95\u5c42\u5b9e\u73b0\u6709\u4e86\u89e3\u8fc7\u5417? \u8bf4\u8bf4\u770b \u524d\u8a00 \u76ee\u524d\u6b63\u5728\u51fa\u4e00\u4e2aJava\u591a\u7ebf\u7a0b\u4e13\u9898\u957f\u671f\u7cfb\u5217\u6559\u7a0b\uff0c\u4ece\u5165\u95e8\u5230\u8fdb\u9636\u542b\u6e90\u7801\u89e3\u8bfb, \u7bc7 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":1336,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[2],"tags":[],"class_list":["post-1339","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java"],"post_thumbnail_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528042144425-150x150.jpeg","content_first_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528042145299.jpeg","post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528042144425-300x128.jpeg","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528042144425.jpeg","post_frist_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528042145299.jpeg","post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528042144425-300x128.jpeg","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528042144425.jpeg","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528042144425.jpeg","post_all_images":[{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528042145299.jpeg","id":"image0"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230528042145299.jpeg","id":"image1"}],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Java","post_date":"2023-05-28","like_count":"0","praiseWord":"\u9f13\u52b1","copyright_state":"","excitationAd":"0","rewardedVideoAdId":"","detailAdId":"","detailAd":"0","enterpriseMinapp":"0","audios":[],"postImageUrl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2023\/05\/20230519082947553.jpg","avatarurls":[],"related_posts":null,"pageviews":337,"next_post_id":1323,"next_post_title":"Java\u591a\u7ebf\u7a0b\u4e13\u9898\u4e4b\u7ebf\u7a0b\u6c60\u7684\u57fa\u672c\u4f7f\u7528","previous_post_id":1939,"previous_post_title":"JVM\u5783\u573e\u6536\u96c6\u5668(\u4e00) ------ \u5783\u573e\u6536\u96c6\u6982\u8ff0","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/1339","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1339"}],"version-history":[{"count":0,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/1339\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media\/1336"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}