{"id":3844,"date":"2024-04-12T08:39:44","date_gmt":"2024-04-12T00:39:44","guid":{"rendered":"https:\/\/xinchewhd.com.cn\/index.php\/java\/threadlocal%e5%ad%a6%e4%b9%a0%e5%9c%a3%e7%bb%8f%ef%bc%9a%e4%b8%80%e6%96%87%e7%a9%bf%e9%80%8ftl%e3%80%81-itl%e3%80%81ttl%e3%80%81ftl%ef%bc%8c%e7%a9%bf%e9%80%8fthreadlocal-%e5%86%85%e5%ad%98%e6%b3%84\/"},"modified":"2024-04-12T08:39:44","modified_gmt":"2024-04-12T00:39:44","slug":"threadlocal%e5%ad%a6%e4%b9%a0%e5%9c%a3%e7%bb%8f%ef%bc%9a%e4%b8%80%e6%96%87%e7%a9%bf%e9%80%8ftl%e3%80%81-itl%e3%80%81ttl%e3%80%81ftl%ef%bc%8c%e7%a9%bf%e9%80%8fthreadlocal-%e5%86%85%e5%ad%98%e6%b3%84","status":"publish","type":"post","link":"https:\/\/xinchewhd.com.cn\/index.php\/java\/threadlocal%e5%ad%a6%e4%b9%a0%e5%9c%a3%e7%bb%8f%ef%bc%9a%e4%b8%80%e6%96%87%e7%a9%bf%e9%80%8ftl%e3%80%81-itl%e3%80%81ttl%e3%80%81ftl%ef%bc%8c%e7%a9%bf%e9%80%8fthreadlocal-%e5%86%85%e5%ad%98%e6%b3%84\/","title":{"rendered":"ThreadLocal\u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6587\u7a7f\u900fTL\u3001 ITL\u3001TTL\u3001FTL\uff0c\u7a7f\u900fThreadLocal \u5185\u5b58\u6cc4\u6f0f"},"content":{"rendered":"<div class='wxsyncmain'>\n<fieldset style=\"margin: 0.8em 33.5px 0.3em;color: rgb(62, 62, 62);font-size: 16px;text-wrap: wrap;line-height: 25.6px;border-width: initial;border-style: initial;border-color: currentcolor;text-align: center;background-color: rgb(255, 255, 255);visibility: visible;\" data-mpa-powered-by=\"yiban.io\">\n<section data-brushtype=\"text\" style=\"padding: 10px 1.2em 10px 0.8em;color: rgb(255, 192, 0);line-height: 1.2;font-size: 18px;font-weight: bold;vertical-align: top;display: inline-block;background-color: rgb(0, 0, 0);visibility: visible;\">FSAC\u672a\u6765\u8d85\u7ea7\u67b6\u6784\u5e08<\/section>\n<p style=\"padding: 9px 4px 10px;border-radius: 8px;border-width: 4px;border-style: solid;border-color: rgb(0, 0, 0);color: rgb(0, 0, 0);font-weight: bold;letter-spacing: 3px;font-size: 20px;visibility: visible;\">\u67b6\u6784\u5e08\u603b\u52a8\u5458<span style=\"letter-spacing: normal;font-size: 18px;visibility: visible;\">\u5b9e\u73b0\u67b6\u6784\u8f6c\u578b\uff0c\u518d\u65e0\u4e2d\u5e74\u5371\u673a<\/span><\/p>\n<p style=\"margin-right: auto;margin-left: auto;width: 0px;height: 10px;border-top: 0.6em solid rgb(0, 0, 0);border-bottom-color: rgb(255, 100, 80);visibility: visible;border-right: 0.7em solid transparent !important;border-left: 0.7em solid transparent !important;\">\n<\/fieldset>\n<section class=\"mp_profile_iframe_wrp\"><mp-common-profile class=\"js_uneditable custom_select_card mp_profile_iframe\" data-pluginname=\"mpprofile\" data-id=\"MzkxNzIyMTM1NQ==\" data-headimg=\"http:\/\/mmbiz.qpic.cn\/mmbiz_png\/xlgvgPaib7WMRF8xl7G3f8DbazOdeA6STL9f3BBk1D0Hsq3L29NS17lH5kUTgicdSuTpjGI4ulMLiaVof6O1nuKXQ\/0?wx_fmt=png\" data-nickname=\"\u6280\u672f\u81ea\u7531\u5708\" data-alias=\"\" data-signature=\"\u75af\u72c2\u521b\u5ba2\u5708\uff08\u6280\u672f\u81ea\u7531\u67b6\u6784\u5708\uff09\uff1a\u4e00\u4e2a \u6280\u672f\u72c2\u4eba\u3001\u6280\u672f\u5927\u795e\u3001\u9ad8\u6027\u80fd \u53d1\u70e7\u53cb \u5708\u5b50\u3002\u5708\u5185\u4e00\u5927\u6ce2\u9876\u7ea7\u9ad8\u624b\u3001\u67b6\u6784\u5e08\u3001\u53d1\u70e7\u53cb\u5df2\u7ecf\u5b9e\u73b0\u6280\u672f\u81ea\u7531\uff1b\u53e6\u5916\u4e00\u5927\u6ce2\u5377\u738b\uff0c\u6b63\u5728\u72e0\u72e0\u5377\uff0c\u5954\u5411\u6280\u672f\u81ea\u7531\" data-from=\"0\" data-is_biz_ban=\"0\"><\/mp-common-profile><span style=\"color: rgb(255, 255, 255);background-color: rgb(30, 30, 30);letter-spacing: 0.034em;\">\u5c3c\u6069\u8bf4\u5728\u524d\u9762<\/span><\/section>\n<section data-tool=\"mdnice\u7f16\u8f91\u5668\" data-website=\"https:\/\/www.mdnice.com\">\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u572840\u5c81\u8001\u67b6\u6784\u5e08 \u5c3c\u6069\u7684<strong>\u8bfb\u8005\u4ea4\u6d41\u7fa4<\/strong>(50+)\u4e2d\uff0c\u5f88\u591a\u5c0f\u4f19\u4f34\u62ff\u5230\u4e86\u4e00\u7ebf\u4e92\u8054\u7f51\u4f01\u4e1a\u5982\u5f97\u7269\u3001\u963f\u91cc\u3001\u6ef4\u6ef4\u3001\u6781\u5154\u3001\u6709\u8d5e\u3001\u5e0c\u97f3\u3001\u767e\u5ea6\u3001\u7f51\u6613\u3001\u7f8e\u56e2\u7684\u9762\u8bd5\u673a\u4f1a\uff0c\u9047\u5230\u5f88\u591a\u5f88\u91cd\u8981\u7684\u9762\u8bd5\u9898\uff1a<\/span><\/section>\n<blockquote data-sourcepos=\"5:1-15:105\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<p style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">1.\u8bf7\u89e3\u91caThreadLocal\u662f\u4ec0\u4e48\uff0c\u4ee5\u53ca\u5b83\u7684\u4e3b\u8981\u7528\u9014\u662f\u4ec0\u4e48\uff1f<\/span><\/p>\n<p style=\"margin-bottom: 16px;line-height: 1.75em;font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\"><span style=\"font-size: 15px;\">2.ThreadLocal\u7684\u5185\u90e8\u673a\u5236\u662f\u600e\u6837\u7684\uff1f\u8bf7\u89e3\u91ca\u4e00\u4e0bThreadLocalMap\u548cEntry\u3002<\/span><\/p>\n<p style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">3.\u4f7f\u7528ThreadLocal\u662f\u5426\u4f1a\u5bfc\u81f4\u5185\u5b58\u6cc4\u6f0f\uff1f\u5982\u679c\u662f\uff0c\u5982\u4f55\u907f\u514d\uff1f<\/span><\/p>\n<p style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">4.\u5728\u4f7f\u7528\u7ebf\u7a0b\u6c60\u65f6\uff0cThreadLocal\u53ef\u80fd\u4f1a\u51fa\u73b0\u4ec0\u4e48\u95ee\u9898\uff1f\u5982\u4f55\u89e3\u51b3\uff1f<\/span><\/p>\n<p style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">5.\u80fd\u5426\u89e3\u91ca\u4e00\u4e0b TransmittableThreadLocal \u4e0eThreadLocal\u7684\u533a\u522b\u548c\u8054\u7cfb\uff1f<\/span><\/p>\n<p style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">6.\u5728\u7236\u5b50\u7ebf\u7a0b\u95f4\u5982\u4f55\u5171\u4eab\u6570\u636e\uff1fThreadLocal\u80fd\u5b9e\u73b0\u5417\uff1f\u5982\u679c\u4e0d\u80fd\uff0c\u90a3\u5e94\u5982\u4f55\u5b9e\u73b0\uff1f<\/span><\/p>\n<\/blockquote>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6700\u8fd1\u6709\u5c0f\u4f19\u4f34\u5728\u9762\u8bd5\u5b57\u8282\uff0c\u53c8\u9047\u5230\u4e86ThreadLocal \u76f8\u5173\u7684\u9762\u8bd5\u9898\u3002\u5c0f\u4f19\u4f34\u61f5\u4e86\uff0c\u652f\u652f\u543e\u543e\u7684\u8bf4\u4e86\u51e0\u53e5\uff0c\u9762\u8bd5\u5b98\u4e0d\u6ee1\u610f\uff0c\u9762\u8bd5\u6302\u4e86\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6240\u4ee5\uff0c\u5c3c\u6069\u7ed9\u5927\u5bb6\u505a\u4e00\u4e0b\u7cfb\u7edf\u5316\u3001\u4f53\u7cfb\u5316\u7684\u68b3\u7406\uff0c\u4f7f\u5f97\u5927\u5bb6\u5185\u529b\u731b\u589e\uff0c\u53ef\u4ee5\u5145\u5206\u5c55\u793a\u4e00\u4e0b\u5927\u5bb6\u96c4\u539a\u7684 \u201c\u6280\u672f\u808c\u8089\u201d\uff0c<strong>\u8ba9\u9762\u8bd5\u5b98\u7231\u5230 \u201c\u4e0d\u80fd\u81ea\u5df2\u3001\u53e3\u6c34\u76f4\u6d41\u201d<\/strong>\uff0c\u7136\u540e\u5b9e\u73b0\u201doffer\u76f4\u63d0\u201d\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u91cc\uff0c\u5c3c\u6069\u56e2\u961f\u628a ThreadLocal\u3001ITL\u3001TTL\u3001FTL\u8fdb\u884c\u4e86\u5168\u9762\u7684\u68b3\u7406\uff0c\u7a7f\u900f\u5f0f\u7684\u68b3\u7406\uff0c<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u68b3\u7406\u4e3a\u4e00\u4e2aPDF\u6587\u6863 \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b\uff0c \u5e76\u4e14\u6301\u7eed\u8fed\u4ee3\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u4e2a\u6587\u6863\u5c06\u6210\u4e3a\u5927\u5bb6 \u9762\u8bd5\u7684\u6740\u624b\u950f\uff0c \u6b64\u6587\u5f53\u6700\u65b0PDF\u7248\u672c\uff0c\u53ef\u4ee5\u627e40\u5c81\u8001\u67b6\u6784\u5e08\u5c3c\u6069\u83b7\u53d6\u3002<\/span><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018226\" data-ratio=\"0.7203703703703703\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142815441.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018226\" data-ratio=\"0.7203703703703703\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142815441.png\"  \/><\/noscript><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5f53\u7136\uff0c\u4e0a\u9762\u7684\u9762\u8bd5\u9898\u4ee5\u53ca\u53c2\u8003\u7b54\u6848\uff0c\u4e5f\u4f1a\u6536\u5165\u54b1\u4eec\u7684 \u300a<\/span><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzkxNzIyMTM1NQ==&amp;mid=2247497474&amp;idx=1&amp;sn=54a7b194a72162e9f13695443eabe186&amp;scene=21#wechat_redirect\" style=\"color: rgb(0, 122, 255);text-decoration: underline;font-size: 15px;\" data-linktype=\"2\" target=\"_blank\"  rel=\"nofollow\" ><span style=\"font-size: 15px;\">\u5c3c\u6069Java\u9762\u8bd5\u5b9d\u5178PDF<\/span><\/a><span style=\"font-size: 15px;\">\u300bV171\u7248\u672c\uff0c\u4f9b\u540e\u9762\u7684\u5c0f\u4f19\u4f34\u53c2\u8003\uff0c\u63d0\u5347\u5927\u5bb6\u7684 3\u9ad8 \u67b6\u6784\u3001\u8bbe\u8ba1\u3001\u5f00\u53d1\u6c34\u5e73\u3002<\/span><\/section>\n<blockquote data-sourcepos=\"35:1-35:172\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6700\u65b0\u300a\u5c3c\u6069 \u67b6\u6784\u7b14\u8bb0\u300b\u300a\u5c3c\u6069\u9ad8\u5e76\u53d1\u4e09\u90e8\u66f2\u300b\u300a\u5c3c\u6069Java\u9762\u8bd5\u5b9d\u5178\u300b\u7684PDF\uff0c\u8bf7\u5173\u6ce8\u672c\u516c\u4f17\u53f7\u3010\u6280\u672f\u81ea\u7531\u5708\u3011\u83b7\u53d6\uff0c\u56de\u590d\uff1a\u9886\u7535\u5b50\u4e66<\/span><\/section>\n<\/blockquote>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u672c\u6587\u4f5c\u8005\uff1a<\/span><\/section>\n<ul data-sourcepos=\"41:1-45:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7b2c\u4e00\u4f5c\u8005 Moen \uff08\u8d1f\u8d23\u5199\u521d\u7a3f \uff09<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7b2c\u4e8c\u4f5c\u8005 \u5c3c\u6069 \uff0840\u5c81\u8001\u67b6\u6784\u5e08\uff0c \u8d1f\u8d23\u63d0\u5347\u6b64\u6587\u7684 \u6280\u672f\u9ad8\u5ea6\uff0c\u8ba9\u5927\u5bb6\u6709\u4e00\u79cd \u4fef\u89c6 \u6280\u672f\u7684\u611f\u89c9\uff09<\/span><\/section>\n<\/li>\n<\/ul>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 22px;margin: 10px auto 5px;border-top: 1px solid rgb(242, 242, 242);background-color: rgb(242, 242, 242);\"><span style=\"margin-top: -1px;padding-top: 14px;padding-bottom: 14px;padding-right: 5px;padding-left: 5px;font-size: 17px;border-top: 4px solid rgb(33, 33, 34);display: inline-block;line-height: 1.5;font-weight: normal;background-color: rgb(30, 30, 30);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 20px;padding-left: 10px;\">\u672c\u6587\u76ee\u5f55<\/span><\/h2>\n<p><span style=\"font-family: &quot;Helvetica Neue&quot;;font-size: 13px;letter-spacing: 0.034em;\"><strong style=\"white-space: normal;\"><span style=\"font-size: 14px;\">- \u5c3c\u6069\u8bf4\u5728\u524d\u9762<\/span><\/strong><\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><strong><strong style=\"font-family: &quot;Helvetica Neue&quot;;font-size: 13px;letter-spacing: 0.44200000166893005px;white-space: normal;\"><span style=\"font-size: 14px;\">-<\/span><\/strong>\u4ec0\u4e48\u662fThreadLocal\uff08TL\uff09\uff1f<\/strong><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocal\u7684\u57fa\u672c\u4f7f\u7528<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocal\u7684\u6210\u5458\u65b9\u6cd5<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocal\u7684\u4f5c\u7528\u548c\u4f18\u52a3\u52bf<\/span><\/p>\n<h5 data-sourcepos=\"299:1-299:178\" style=\"letter-spacing: 0.578px;white-space: normal;\"><span style=\"font-size: 14px;letter-spacing: 0.578px;\">  -<strong style=\"font-family: &quot;Helvetica Neue&quot;;font-size: 13px;letter-spacing: 0.578px;text-wrap: wrap;\">TL<\/strong><\/span><span style=\"font-size: 14px;font-family: &quot;Helvetica Neue&quot;;letter-spacing: 0.034em;\">\u4f5c\u7528<\/span><\/h5>\n<h5 data-sourcepos=\"299:1-299:178\" style=\"letter-spacing: 0.578px;white-space: normal;\"><span style=\"font-size: 14px;letter-spacing: 0.578px;\">  -<strong style=\"font-family: &quot;Helvetica Neue&quot;;font-size: 13px;letter-spacing: 0.578px;text-wrap: wrap;\">TL<\/strong><\/span><span style=\"font-size: 14px;font-family: &quot;Helvetica Neue&quot;;letter-spacing: 0.034em;\">\u4f18\u52bf<\/span><\/h5>\n<h5 data-sourcepos=\"299:1-299:178\" style=\"letter-spacing: 0.578px;white-space: normal;\"><span style=\"font-size: 14px;letter-spacing: 0.578px;\">  -<strong style=\"font-family: &quot;Helvetica Neue&quot;;font-size: 13px;letter-spacing: 0.578px;text-wrap: wrap;\">TL<\/strong><\/span><span style=\"font-size: 14px;font-family: &quot;Helvetica Neue&quot;;letter-spacing: 0.034em;\">\u52a3\u52bf<\/span><\/h5>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocal\u7684\u4f7f\u7528\u573a\u666f<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>\u573a\u666f1\uff1a\u4f7f\u7528ThreadLocal\u8fdb\u884c\u7ebf\u7a0b\u9694\u79bb<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>\u573a\u666f2\uff1a\u4f7f\u7528ThreadLocal\u8fdb\u884c\u8de8\u51fd\u6570\u6570\u636e\u4f20\u9012<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>\u573a\u666f3\uff1aThreadLocal\u5728Java\u6846\u67b6\u4e2d\u7684\u5e94\u7528<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocal\u7efc\u5408\u4f7f\u7528\u6848\u4f8b<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocal \u4f7f\u7528\u603b\u7ed3<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><strong><strong style=\"font-family: &quot;Helvetica Neue&quot;;font-size: 13px;white-space: normal;\"><strong style=\"letter-spacing: 0.44200000166893005px;\"><span style=\"font-size: 14px;\">-<\/span><\/strong><\/strong>ThreadLocal\u7684\u5b9e\u73b0\u539f\u7406<\/strong><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocal\u5185\u90e8\u7ed3\u6784\u6f14\u8fdb<span style=\"font-family: &quot;Helvetica Neue&quot;;display: none;line-height: 0px;\">\u200d\u200d\u200d<\/span><\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocalMap\u5bf9\u8c61\u548cEntry\u662f\u4ec0\u4e48<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocal\u7684\u7ed3\u6784\u6a21\u578b<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocal\u6e90\u7801\u5206\u6790<\/span><\/p>\n<h5 data-sourcepos=\"299:1-299:178\" style=\"letter-spacing: 0.578px;white-space: normal;\"><span style=\"font-size: 14px;letter-spacing: 0.578px;\">  -<\/span><span style=\"font-size: 14px;font-family: &quot;Helvetica Neue&quot;;letter-spacing: 0.034em;\">set(T value)\u65b9\u6cd5<\/span><\/h5>\n<h5 data-sourcepos=\"299:1-299:178\" style=\"letter-spacing: 0.578px;white-space: normal;\"><span style=\"font-size: 14px;letter-spacing: 0.578px;\">  -<\/span><span style=\"font-size: 14px;font-family: &quot;Helvetica Neue&quot;;letter-spacing: 0.034em;\">get( )\u65b9\u6cd5<\/span><\/h5>\n<h5 data-sourcepos=\"299:1-299:178\" style=\"letter-spacing: 0.578px;white-space: normal;\"><span style=\"font-size: 14px;letter-spacing: 0.578px;\">  -<\/span><span style=\"font-size: 14px;font-family: &quot;Helvetica Neue&quot;;letter-spacing: 0.034em;\">remove( )\u65b9\u6cd5<\/span><\/h5>\n<h5 data-sourcepos=\"299:1-299:178\" style=\"letter-spacing: 0.578px;white-space: normal;\"><span style=\"font-size: 14px;letter-spacing: 0.578px;\">  -<\/span><span style=\"font-size: 14px;font-family: &quot;Helvetica Neue&quot;;letter-spacing: 0.034em;\">initialValue( ) \u65b9\u6cd5<\/span><\/h5>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocalMap\u6e90\u7801\u5206\u6790<\/span><\/p>\n<h5 data-sourcepos=\"299:1-299:178\" style=\"letter-spacing: 0.578px;white-space: normal;\"><span style=\"font-size: 14px;letter-spacing: 0.578px;\">  -<\/span><span style=\"font-size: 14px;font-family: &quot;Helvetica Neue&quot;;letter-spacing: 0.034em;\">ThreadLocalMap\u7684\u4e3b\u8981\u6210\u5458\u53d8\u91cf<\/span><\/h5>\n<h5 data-sourcepos=\"299:1-299:178\" style=\"letter-spacing: 0.578px;white-space: normal;\"><span style=\"font-size: 14px;letter-spacing: 0.578px;\">  -<\/span><span style=\"font-size: 14px;font-family: &quot;Helvetica Neue&quot;;letter-spacing: 0.034em;\">Entry\u7684Key\u9700\u8981\u4f7f\u7528\u5f31\u5f15\u7528<\/span><\/h5>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><strong><strong style=\"font-family: &quot;Helvetica Neue&quot;;font-size: 13px;white-space: normal;\"><strong style=\"letter-spacing: 0.44200000166893005px;\"><span style=\"font-size: 14px;\">-<\/span><\/strong><\/strong>ThreadLocal\u9020\u6210\u5185\u5b58\u6cc4\u9732\u7684\u95ee\u9898<\/strong><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocal\u662f\u600e\u4e48\u9020\u6210\u5185\u5b58\u6cc4\u9732\u7684\u5462\uff1f<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocal \u6709\u4e24\u4e2a\u5f15\u7528\u94fe<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>\u60c5\u51b51\uff1akey\u7684<strong style=\"font-family: &quot;Helvetica Neue&quot;;font-size: 13px;letter-spacing: 0.578px;text-wrap: wrap;\">\u5185\u5b58<\/strong>\u6cc4\u6f0f<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>\u60c5\u51b52\uff1avalue\u7684<strong style=\"font-family: &quot;Helvetica Neue&quot;;font-size: 13px;letter-spacing: 0.578px;text-wrap: wrap;\">\u5185\u5b58<\/strong>\u6cc4\u6f0f<\/span><\/p>\n<h3 data-sourcepos=\"1031:1-1031:71\" style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>\u60c5\u51b51\u7684\u89e3\u51b3\u65b9\u6848\uff1a\u4f7f\u7528\u5f31\u5f15\u7528\uff0c\u89e3\u51b3key\u7684\u5185\u5b58\u6cc4\u9732<\/span><\/h3>\n<h3 data-sourcepos=\"1088:1-1088:64\" style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>\u60c5\u51b52\u7684\u89e3\u51b3\u65b9\u6848\uff1a\u6e05\u7406\u7b56\u7565\u89e3\u51b3value\u5185\u5b58\u6cc4\u9732<\/span><\/h3>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>\u6e90\u7801\uff1avalue\u7684 \u63a2\u6d4b\u5f0f\u6e05\u7406 \uff1a<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>\u6e90\u7801\uff1avalue\u7684\u542f\u53d1\u5f0f\u6e05\u7406\uff1a<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>\u4e1a\u52a1\u4e3b\u52a8\u6e05\u7406\uff1a\u624b\u52a8\u6e05\u9664\u89e3\u51b3\u5185\u5b58\u6cc4\u9732<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocal\u4e0e\u5185\u5b58\u6cc4\u9732\uff1a\u9632\u8303\u4e0e\u8bca\u65ad<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><strong><strong style=\"font-family: &quot;Helvetica Neue&quot;;font-size: 13px;white-space: normal;\"><strong style=\"letter-spacing: 0.44200000166893005px;\"><span style=\"font-size: 14px;\">-<\/span><\/strong><\/strong>\u4f7f\u7528ThreadLocal\u7684\u6027\u80fd\u95ee\u9898\u548c\u4f18\u5316\u63aa\u65bd<\/strong><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocal\u7684\u6027\u80fd\u5f00\u9500<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>\u7f16\u7a0b\u89c4\u8303\uff1a\u63a8\u8350\u4f7f\u7528 static final \u4fee\u9970ThreadLocal\u5bf9\u8c61<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>TheadLocal\u5bf9\u8c61\u5b9e\u4f8b\u5b58\u5728\u5f3a\u5f15\u7528\uff0c\u4f1a\u5bfc\u81f4\u4e09\u4e2a\u5f7b\u5e95\u5931\u6548\uff1a<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><strong><strong style=\"font-family: &quot;Helvetica Neue&quot;;font-size: 13px;white-space: normal;\"><strong style=\"letter-spacing: 0.44200000166893005px;\"><span style=\"font-size: 14px;\">-<\/span><\/strong><\/strong>ThreadLocal\u5347\u7ea7\u72481\uff1aInheritableThreadLocal \u53ef\u7ee7\u627f\u672c\u5730\u53d8\u91cf<\/strong><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>\u4ec0\u4e48\u662f\u53ef\u7ee7\u627f\u672c\u5730\u53d8\u91cfInheritableThreadLocal\uff08ITL\uff09?<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>InheritableThreadLocal\u7684\u57fa\u672c\u4f7f\u7528<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>InheritableThreaLocal\u7684\u539f\u7406\u5206\u6790<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>InheritableThreaLocal\u6240\u5e26\u6765\u7684\u95ee\u9898<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><strong><strong style=\"font-family: &quot;Helvetica Neue&quot;;font-size: 13px;white-space: normal;\"><strong style=\"letter-spacing: 0.44200000166893005px;\"><span style=\"font-size: 14px;\">-<\/span><\/strong><\/strong>ThreadLocal\u5347\u7ea7\u72482\uff1aTransmittableThreadLocal \u53ef\u900f\u4f20\u672c\u5730\u53d8\u91cf<\/strong><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>\u4ec0\u4e48\u662fTransmittableThreadLocal\uff08TTL\uff09\uff1f<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>TTL \u4f7f\u7528\u573a\u666f<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>TransmittableThreadLocal\u7684\u539f\u7406\u5206\u6790<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocal\u3001InheritableThreaLocal\u4e0eTransmittableThreadLocal\u7684\u6bd4\u8f83<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>ThreadLocal\u548csynchronized\u4e4b\u95f4\u7684\u6bd4\u8f83<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><strong><strong style=\"font-family: &quot;Helvetica Neue&quot;;font-size: 13px;white-space: normal;\"><strong style=\"letter-spacing: 0.44200000166893005px;\"><span style=\"font-size: 14px;\">-<\/span><\/strong><\/strong>FastThreadLocal \uff08FTL\uff09\u9ad8\u6027\u80fd\u672c\u5730\u53d8\u91cf\u7684\u5b9e\u73b0\u539f\u7406<\/strong><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>\u4ec0\u4e48\u662fFastThreadLocal \uff08FTL\uff09\uff1f<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>FastThreadLocal \u5982\u4f55\u4f7f\u7528<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>FastThreadLocal \u7684\u4f18\u52bf<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>FastThreadLocal \u4e3a\u4ec0\u4e48\u5feb<\/span><\/p>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;\">-<\/span>FastThreadLocal \u6e90\u7801\u5206\u6790<\/span><\/p>\n<h5 data-sourcepos=\"299:1-299:178\" style=\"letter-spacing: 0.578px;white-space: normal;\"><span style=\"font-size: 14px;letter-spacing: 0.578px;\">  -<\/span><span style=\"font-size: 14px;font-family: &quot;Helvetica Neue&quot;;letter-spacing: 0.034em;\">FastThreadLocal \u7684\u56de\u6536\u673a\u5236<\/span><\/h5>\n<h5 data-sourcepos=\"299:1-299:178\" style=\"letter-spacing: 0.578px;white-space: normal;\"><span style=\"font-size: 14px;letter-spacing: 0.578px;\">  -<\/span><span style=\"font-size: 14px;font-family: &quot;Helvetica Neue&quot;;letter-spacing: 0.034em;\">FastThreadLocal \u5728Netty\u4e2d\u7684\u5e94\u7528<\/span><\/h5>\n<p style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><span style=\"font-size: 14px;\"><span style=\"font-stretch: normal;font-family: &quot;PingFang SC&quot;;\"><span style=\"font-family: &quot;Helvetica Neue&quot;;font-size: 14px;\">-<\/span>\u548c<\/span>ThreadLocal<span style=\"font-stretch: normal;font-family: &quot;PingFang SC&quot;;\">\u76f8\u6bd4\uff0c<\/span> FastThreadLocal <span style=\"font-stretch: normal;font-family: &quot;PingFang SC&quot;;\">\u7684\u4f18\u52bf\uff1a<\/span><\/span><\/p>\n<h2 data-sourcepos=\"1676:1-1676:45\" style=\"font-stretch: normal;font-size: 13px;font-family: &quot;Helvetica Neue&quot;;\"><strong><strong style=\"font-family: &quot;Helvetica Neue&quot;;font-size: 13px;white-space: normal;\"><strong style=\"letter-spacing: 0.44200000166893005px;\"><span style=\"font-size: 14px;\">-<\/span><\/strong><\/strong>\u8bf4\u5728\u6700\u540e\uff1a\u6709\u95ee\u9898\u627e\u8001\u67b6\u6784\u53d6\u7ecf<\/strong><\/h2>\n<h2 data-sourcepos=\"50:1-50:34\" style=\"font-weight: bold;font-size: 22px;margin: 10px auto 5px;border-top-width: 1px;border-top-style: solid;border-top-color: rgb(242, 242, 242);background-color: rgb(242, 242, 242);\"><span style=\"margin-top: -1px;padding-top: 14px;padding-bottom: 14px;padding-right: 5px;padding-left: 5px;font-size: 17px;border-top: 4px solid rgb(33, 33, 34);display: inline-block;line-height: 1.5;font-weight: normal;background-color: rgb(30, 30, 30);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 20px;padding-left: 10px;\">\u4ec0\u4e48\u662fThreadLocal\uff08TL\uff09\uff1f<\/span><\/h2>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728Java\u7684\u591a\u7ebf\u7a0b\u5e76\u53d1\u6267\u884c\u8fc7\u7a0b\u4e2d\uff0c\u4e3a\u4fdd\u8bc1\u591a\u4e2a\u7ebf\u7a0b\u5bf9\u53d8\u91cf\u7684\u5b89\u5168\u8bbf\u95ee\uff0c\u53ef\u4ee5\u5c06\u53d8\u91cf\u653e\u5230ThreadLocal\u7c7b\u578b\u7684\u5bf9\u8c61\u4e2d\uff0c\u4f7f\u53d8\u91cf\u5728\u6bcf\u4e2a\u7ebf\u7a0b\u4e2d\u90fd\u6709\u72ec\u7acb\u503c\uff0c\u4e0d\u4f1a\u51fa\u73b0\u4e00\u4e2a\u7ebf\u7a0b\u8bfb\u53d6\u53d8\u91cf\u65f6\u800c\u88ab\u53e6\u4e00\u4e2a\u7ebf\u7a0b\u4fee\u6539\u7684\u73b0\u8c61\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u7c7b\u901a\u5e38\u88ab\u7ffb\u8bd1\u4e3a\u201c<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf<\/span><\/code><span style=\"font-size: 15px;\">\u201d \uff0c\u6216\u8005\u201c<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u7ebf\u7a0b\u5c40\u90e8\u53d8\u91cf<\/span><\/code><span style=\"font-size: 15px;\">\u201d \u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u7684\u82f1\u6587\u5b57\u9762\u7ffb\u8bd1\u4e3a\u201c<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u7ebf\u7a0b\u672c\u5730<\/span><\/code><span style=\"font-size: 15px;\">\u201d\uff0c\u5b9e\u8d28\u4e0aThreadLocal\u4ee3\u8868\u7684\u662f\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\uff0c\u53ef\u80fd\u5c06\u5176\u547d\u540d\u4e3a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocalVariable<\/span><\/code><span style=\"font-size: 15px;\">\u4f1a\u66f4\u52a0\u5bb9\u6613\u8ba9\u4eba\u7406\u89e3\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u4ee5\u4e0b\u6765\u81f3\u5b98\u7f51\u7684\u89e3\u91ca<\/strong>\uff1a<\/span><\/section>\n<blockquote data-sourcepos=\"60:1-64:355\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">This class provides thread-local variables. These variables differ from their normal counterparts in that each thread that accesses one (via its get or set method) has its own, independently initialized copy of the variable. ThreadLocal instances are typically private static fields in classes that wish to associate state with a thread (e.g., a user ID or Transaction ID).<\/span><\/section>\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7b80\u5355\u7ffb\u8bd1\u5982\u4e0b\uff1a<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6b64\u7c7b\u63d0\u4f9b<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u7ebf\u7a0b\u5c40\u90e8\u53d8\u91cf<\/span><\/code><span style=\"font-size: 15px;\">\u3002\u8fd9\u4e9b\u53d8\u91cf\u4e0e\u5176\u6b63\u5e38\u5bf9\u5e94\u53d8\u91cf\u7684\u4e0d\u540c\u4e4b\u5904\u5728\u4e8e\uff0c\u6bcf\u4e2a\u8bbf\u95ee\u4e00\u4e2a\u53d8\u91cf\uff08\u901a\u8fc7\u5176get\u6216set\u65b9\u6cd5\uff09\u7684\u7ebf\u7a0b\u90fd\u6709<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u81ea\u5df1\u7684<\/span><\/code><span style=\"font-size: 15px;\">\u3001<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u72ec\u7acb\u521d\u59cb\u5316\u7684\u53d8\u91cf\u526f\u672c<\/span><\/code><span style=\"font-size: 15px;\">\u3002ThreadLocal\u5b9e\u4f8b\u901a\u5e38\u662f\u7c7b\u4e2d\u7684<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u79c1\u6709\u9759\u6001\u5b57\u6bb5<\/span><\/code><span style=\"font-size: 15px;\">\uff0c\u8fd9\u4e9b\u5b57\u6bb5\u5e0c\u671b\u5c06\u72b6\u6001\u4e0e\u7ebf\u7a0b\uff08\u4f8b\u5982\uff0c\u7528\u6237ID\u6216\u4e8b\u52a1ID\uff09\u76f8\u5173\u8054\u3002<\/span><\/section>\n<\/blockquote>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u603b\u7ed3\u91cd\u70b9\u5982\u4e0b<\/strong>\uff1a<\/span><\/section>\n<ol data-sourcepos=\"68:1-71:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal \u63d0\u4f9b\u4e86\u4e00\u79cd\u8bbf\u95ee\u67d0\u4e2a\u53d8\u91cf\u7684\u7279\u6b8a\u65b9\u5f0f\uff1a\u8bbf\u95ee\u5230\u7684\u53d8\u91cf\u5c5e\u4e8e\u5f53\u524d\u7ebf\u7a0b\uff0c\u5373\u4fdd\u8bc1\u6bcf\u4e2a\u7ebf\u7a0b\u7684\u53d8\u91cf\u4e0d\u4e00\u6837\uff0c\u800c\u540c\u4e00\u4e2a\u7ebf\u7a0b\u5728\u4efb\u4f55\u5730\u65b9\u62ff\u5230\u7684\u53d8\u91cf\u90fd\u662f\u5f53\u524d\u8fd9\u4e2a\u7ebf\u7a0b\u79c1\u6709\u7684\uff0c\u8fd9\u5c31\u662f\u6240\u8c13\u7684\u7ebf\u7a0b\u9694\u79bb\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5982\u679c\u8981\u4f7f\u7528 ThreadLocal\uff0c\u901a\u5e38\u5b9a\u4e49\u4e3a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">private static<\/span><\/code><span style=\"font-size: 15px;\">\u7c7b\u578b\uff0c\u6839\u636e\u7f16\u7a0b\u8303\u5f0f\u6700\u597d\u662f\u5b9a\u4e49\u4e3a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">private static final<\/span><\/code><span style=\"font-size: 15px;\">\u7c7b\u578b\u3002<\/span><\/section>\n<\/li>\n<\/ol>\n<h3 data-sourcepos=\"72:1-72:30\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">ThreadLocal\u7684\u57fa\u672c\u4f7f\u7528<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u662f\u4f4d\u4e8eJDK\u7684java.lang\u6838\u5fc3\u5305\u4e2d\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5982\u679c\u7a0b\u5e8f\u521b\u5efa\u4e86\u4e00\u4e2aThreadLocal\u5b9e\u4f8b\uff0c\u90a3\u4e48\u5728\u8bbf\u95ee\u8fd9\u4e2a\u53d8\u91cf\u7684\u503c\u65f6\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u4f1a\u62e5\u6709\u4e00\u4e2a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u72ec\u7acb\u7684<\/span><\/code><span style=\"font-size: 15px;\">\u3001<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u81ea\u5df1\u7684\u672c\u5730\u503c<\/span><\/code><span style=\"font-size: 15px;\">\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u201c<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf<\/span><\/code><span style=\"font-size: 15px;\">\u201d \u53ef\u4ee5\u770b\u6210\u4e13\u5c5e\u4e8e\u7ebf\u7a0b\u7684\u53d8\u91cf\uff0c\u4e0d\u53d7\u5176\u4ed6\u7ebf\u7a0b\u5e72\u6270\uff0c\u4fdd\u5b58\u7740\u7ebf\u7a0b\u7684\u4e13\u5c5e\u6570\u636e\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5f53\u7ebf\u7a0b\u7ed3\u675f\u540e\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u6240\u62e5\u6709\u7684\u90a3\u4e00\u4e2a\u672c\u5730\u503c\u4e5f\u4f1a\u88ab\u91ca\u653e\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728\u591a\u7ebf\u7a0b\u5e76\u53d1\u64cd\u4f5c\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u65f6\u5019\uff0c\u7ebf\u7a0b\u5404\u81ea\u64cd\u4f5c\u7684\u662f\u81ea\u5df1\u7684\u672c\u5730\u503c\uff0c\u4ece\u800c\u89c4\u907f\u4e86\u7ebf\u7a0b\u5b89\u5168\u95ee\u9898\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u5982\u4f55\u662f\u505a\u5230\u4e3a\u6bcf\u4e2a\u7ebf\u7a0b\u5b58\u6709\u4e00\u4efd\u72ec\u7acb\u7684\u672c\u5730\u503c\u7684\u5462\uff1f<\/span><\/section>\n<blockquote data-sourcepos=\"87:1-87:434\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e00\u4e2aThreadLocal\u5b9e\u4f8b\u53ef\u4ee5\u5f62\u8c61\u5730\u7406\u89e3\u4e3a\u4e00\u4e2aMap\uff08\u65e9\u671f\u7248\u672c\u7684ThreadLocal\u662f\u8fd9\u6837\u8bbe\u8ba1\u7684\uff09\u3002\u5f53\u5de5\u4f5c\u7ebf\u7a0bThread\u5b9e\u4f8b\u5411\u672c\u5730\u53d8\u91cf\u4fdd\u6301\u67d0\u4e2a\u503c\u65f6\uff0c\u4f1a\u4ee5\u201c<strong>Key-Value\u5bf9<\/strong>\u201d\u7684\u5f62\u5f0f\u4fdd\u5b58\u5728ThreadLocal\u5185\u90e8\u7684Map\u4e2d\uff0c\u5176\u4e2d<strong>Key\u4e3a\u7ebf\u7a0bThread\u5b9e\u4f8b<\/strong>\uff0c<strong>Value\u4e3a\u5f85\u4fdd\u5b58\u7684\u503c<\/strong>\u3002\u5f53\u5de5\u4f5c\u7ebf\u7a0bThread\u5b9e\u4f8b\u4eceThreadLocal\u672c\u5730\u53d8\u91cf\u53d6\u503c\u65f6\uff0c\u4f1a\u4ee5Thread\u5b9e\u4f8b\u4e3aKey\uff0c\u83b7\u53d6\u5176\u7ed1\u5b9a\u7684Value\u3002<\/span><\/section>\n<\/blockquote>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e00\u4e2aThreadLocal\u5b9e\u4f8b\u5185\u90e8\u7ed3\u6784\u7684\u5f62\u8c61\u5c55\u793a\uff0c\u5927\u81f4\u5982\u56fe1-18\u6240\u793a\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\">\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018208\" data-ratio=\"1.0092081031307552\" data-s=\"300,640\"  data-type=\"png\" data-w=\"543\" style=\"\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142827302.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018208\" data-ratio=\"1.0092081031307552\" data-s=\"300,640\"  data-type=\"png\" data-w=\"543\" style=\"\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142827302.png\"  \/><\/noscript><\/p>\n<\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u56fe1-18 \u4e00\u4e2aThreadLocal\uff08\u65e9\u671f\u7248\u672c\uff09\u5b9e\u4f8b\u5185\u90e8\u7ed3\u6784\u7684\u5f62\u8c61\u5c55\u793a<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">Java\u7a0b\u5e8f\u53ef\u4ee5\u4f7f\u7528ThreadLocal\u7684\u6210\u5458\u65b9\u6cd5\u8fdb\u884c\u672c\u5730\u503c\u64cd\u4f5c\uff0c\u5177\u4f53\u7684\u6210\u5458\u65b9\u6cd5\u5982\u88681-2\u6240\u793a\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u88681-2 ThreadLocal\u7684\u6210\u5458\u65b9\u6cd5<\/span><span style=\"font-size: 15px;background-color: rgb(246, 248, 250);color: rgba(0, 0, 0, 0.9);font-family: mp-quote, -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 0.034em;text-align: justify;\">            <\/span><\/section>\n<table data-sourcepos=\"101:1-105:91\" width=\"473\">\n<thead>\n<tr data-sourcepos=\"101:1-101:69\" style=\"background-color: rgb(255, 255, 255);border-top-width: 1px;border-top-style: solid;border-top-color: rgb(198, 203, 209);\">\n<td><span style=\"font-size: 15px;letter-spacing: 0.578px;text-wrap: wrap;background-color: rgb(246, 248, 250);\">\u65b9 \u6cd5<\/span><\/td>\n<td><span style=\"letter-spacing: 0.578px;text-wrap: wrap;font-size: 15px;\"><\/span><span style=\"text-wrap: wrap;font-size: 15px;letter-spacing: 0.034em;\">\u8bf4 \u660e<\/span><\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr data-sourcepos=\"103:1-103:91\" style=\"background-color: rgb(255, 255, 255);border-top-width: 1px;border-top-style: solid;border-top-color: rgb(198, 203, 209);\">\n<td data-sourcepos=\"103:2-103:15\" style=\"padding: 6px 13px;border-color: rgb(223, 226, 229);\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">set(T value)<\/span><\/section>\n<\/td>\n<td data-sourcepos=\"103:17-103:90\" style=\"padding: 6px 13px;border-color: rgb(223, 226, 229);\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8bbe\u7f6e\u5f53\u524d\u7ebf\u7a0b\u5728\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u5b9e\u4f8b\u4e2d\u7ed1\u5b9a\u7684\u672c\u5730\u503c<\/span><\/section>\n<\/td>\n<\/tr>\n<tr data-sourcepos=\"104:1-104:91\" style=\"background-color: rgb(246, 248, 250);border-top-width: 1px;border-top-style: solid;border-top-color: rgb(198, 203, 209);\">\n<td data-sourcepos=\"104:2-104:15\" style=\"padding: 6px 13px;border-color: rgb(223, 226, 229);\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">T get()<\/span><\/section>\n<\/td>\n<td data-sourcepos=\"104:17-104:90\" style=\"padding: 6px 13px;border-color: rgb(223, 226, 229);\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u83b7\u5f97\u5f53\u524d\u7ebf\u7a0b\u5728\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u5b9e\u4f8b\u4e2d\u7ed1\u5b9a\u7684\u672c\u5730\u503c<\/span><\/section>\n<\/td>\n<\/tr>\n<tr data-sourcepos=\"105:1-105:91\" style=\"background-color: rgb(255, 255, 255);border-top-width: 1px;border-top-style: solid;border-top-color: rgb(198, 203, 209);\">\n<td data-sourcepos=\"105:2-105:15\" style=\"padding: 6px 13px;border-color: rgb(223, 226, 229);\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">remove()<\/span><\/section>\n<\/td>\n<td data-sourcepos=\"105:17-105:90\" style=\"padding: 6px 13px;border-color: rgb(223, 226, 229);\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u79fb\u9664\u5f53\u524d\u7ebf\u7a0b\u5728\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u5b9e\u4f8b\u4e2d\u7ed1\u5b9a\u7684\u672c\u5730\u503c<\/span><\/section>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e0b\u9762\u7684\u4f8b\u5b50\uff0c\u901a\u8fc7ThreadLocal\u7684\u6210\u5458\u65b9\u6cd5\u8fdb\u884c\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u4e2d\u7ebf\u7a0b\u672c\u5730\u503c\u7684\u8bbe\u7f6e\u3001\u83b7\u53d6\u3001\u79fb\u9664\uff0c\u5177\u4f53\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"111:1-177:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">package<\/span> com.crazymakercircle.mutithread.basic.threadlocal;...\u7701\u7565<span style=\"color: rgb(1, 86, 146);\">import<\/span><span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">class<\/span> <span style=\"color: rgb(183, 85, 1);\">ThreadLocalTest<\/span>{    <span style=\"color: rgb(1, 86, 146);\">@Data<\/span>    <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">class<\/span> <span style=\"color: rgb(183, 85, 1);\">Foo<\/span>    {        <span style=\"color: rgb(101, 110, 119);\">\/\/\u5b9e\u4f8b\u603b\u6570<\/span>        <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> AtomicInteger AMOUNT = <span style=\"color: rgb(1, 86, 146);\">new<\/span> AtomicInteger(<span style=\"color: rgb(183, 85, 1);\">0<\/span>);        <span style=\"color: rgb(101, 110, 119);\">\/\/\u5bf9\u8c61\u7684\u7f16\u53f7<\/span>        <span style=\"color: rgb(1, 86, 146);\">int<\/span> index = <span style=\"color: rgb(183, 85, 1);\">0<\/span>;        <span style=\"color: rgb(101, 110, 119);\">\/\/\u5bf9\u8c61\u7684\u5185\u5bb9<\/span>        <span style=\"color: rgb(1, 86, 146);\">int<\/span> bar = <span style=\"color: rgb(183, 85, 1);\">10<\/span>;        <span style=\"color: rgb(101, 110, 119);\">\/\/\u6784\u9020\u5668<\/span>        <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(183, 85, 1);\">Foo<\/span>()        {            index = AMOUNT.incrementAndGet(); <span style=\"color: rgb(101, 110, 119);\">\/\/\u603b\u6570\u589e\u52a0\uff0c\u5e76\u4e14\u7ed9\u5bf9\u8c61\u7684\u7f16\u53f7<\/span>        }        <span style=\"color: rgb(1, 86, 146);\">@Override<\/span>        <span style=\"color: rgb(1, 86, 146);\">public<\/span> String <span style=\"color: rgb(183, 85, 1);\">toString<\/span>()        {            <span style=\"color: rgb(1, 86, 146);\">return<\/span> index + <span style=\"color: rgb(84, 121, 13);\">\"@Foo{bar=\"<\/span> + bar + <span style=\"color: rgb(84, 121, 13);\">'}'<\/span>;        }    }    <span style=\"color: rgb(101, 110, 119);\">\/\/\u5b9a\u4e49\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf<\/span>    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> ThreadLocal&lt;Foo&gt; LOCAL_FOO =  <span style=\"color: rgb(1, 86, 146);\">new<\/span> ThreadLocal&lt;Foo&gt;();    <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">main<\/span>(String[] args) <span style=\"color: rgb(1, 86, 146);\">throws<\/span> InterruptedException    {         <span style=\"color: rgb(101, 110, 119);\">\/\/\u83b7\u53d6\u81ea\u5b9a\u4e49\u7684\u6df7\u5408\u578b\u7ebf\u7a0b\u6c60<\/span>        ThreadPoolExecutor threadPool =                                 ThreadUtil.getMixedTargetThreadPool();        <span style=\"color: rgb(101, 110, 119);\">\/\/\u63d0\u4ea45\u4e2a\u4efb\u52a1\uff0c\u5c06\u4f1a\u7528\u52305\u4e2a\u7ebf\u7a0b<\/span>        <span style=\"color: rgb(1, 86, 146);\">for<\/span> (<span style=\"color: rgb(1, 86, 146);\">int<\/span> i = <span style=\"color: rgb(183, 85, 1);\">0<\/span>; i &lt; <span style=\"color: rgb(183, 85, 1);\">5<\/span>; i++)        {            threadPool.execute(<span style=\"color: rgb(1, 86, 146);\">new<\/span> Runnable()            {                <span style=\"color: rgb(1, 86, 146);\">@Override<\/span>                <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">run<\/span>()                {                    <span style=\"color: rgb(101, 110, 119);\">\/\/\u83b7\u53d6\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u4e2d\u5f53\u524d\u7ebf\u7a0b\u6240\u7ed1\u5b9a\u7684\u503c<\/span>                    <span style=\"color: rgb(1, 86, 146);\">if<\/span> (LOCAL_FOO.get() == <span style=\"color: rgb(1, 86, 146);\">null<\/span>)                    {                        <span style=\"color: rgb(101, 110, 119);\">\/\/\u8bbe\u7f6e\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u4e2d\u5f53\u524d\u7ebf\u7a0b\u6240\u7ed1\u5b9a\u7684\u503c<\/span>                        LOCAL_FOO.set(<span style=\"color: rgb(1, 86, 146);\">new<\/span> Foo());                    }                       Print.tco(<span style=\"color: rgb(84, 121, 13);\">\"\u521d\u59cb\u7684\u672c\u5730\u503c\uff1a\"<\/span> + LOCAL_FOO.get());                    <span style=\"color: rgb(101, 110, 119);\">\/\/\u6bcf\u4e2a\u7ebf\u7a0b\u6267\u884c10\u6b21<\/span>                    <span style=\"color: rgb(1, 86, 146);\">for<\/span> (<span style=\"color: rgb(1, 86, 146);\">int<\/span> i = <span style=\"color: rgb(183, 85, 1);\">0<\/span>; i &lt; <span style=\"color: rgb(183, 85, 1);\">10<\/span>; i++)                    {                        Foo foo = LOCAL_FOO.get();                        foo.setBar(foo.getBar() + <span style=\"color: rgb(183, 85, 1);\">1<\/span>);  <span style=\"color: rgb(101, 110, 119);\">\/\/\u503c\u589e1<\/span>                        sleepMilliSeconds(<span style=\"color: rgb(183, 85, 1);\">10<\/span>);                    }                    Print.tco(<span style=\"color: rgb(84, 121, 13);\">\"\u7d2f\u52a010\u6b21\u4e4b\u540e\u7684\u672c\u5730\u503c\uff1a\"<\/span> + LOCAL_FOO.get());                    <span style=\"color: rgb(101, 110, 119);\">\/\/\u5220\u9664\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u4e2d\u5f53\u524d\u7ebf\u7a0b\u6240\u7ed1\u5b9a\u7684\u503c<\/span>                    LOCAL_FOO.remove(); <span style=\"color: rgb(101, 110, 119);\">\/\/\u8fd9\u70b9\u5bf9\u4e8e\u7ebf\u7a0b\u6c60\u4e2d\u7684\u7ebf\u7a0b\u5c24\u5176\u91cd\u8981<\/span>                }            });        }    }}<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd0\u884c\u4ee5\u4e0a\u793a\u4f8b\uff0c\u5176\u7ed3\u679c\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"181:1-192:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\">[apppool-<span style=\"color: rgb(183, 85, 1);\">1<\/span>-mixed-<span style=\"color: rgb(183, 85, 1);\">3<\/span>]\uff1a\u521d\u59cb\u7684\u672c\u5730\u503c\uff1a<span style=\"color: rgb(183, 85, 1);\">3<\/span><span style=\"color: rgb(1, 86, 146);\">@Foo<\/span>{bar=<span style=\"color: rgb(183, 85, 1);\">10<\/span>}[apppool-<span style=\"color: rgb(183, 85, 1);\">1<\/span>-mixed-<span style=\"color: rgb(183, 85, 1);\">4<\/span>]\uff1a\u521d\u59cb\u7684\u672c\u5730\u503c\uff1a<span style=\"color: rgb(183, 85, 1);\">4<\/span><span style=\"color: rgb(1, 86, 146);\">@Foo<\/span>{bar=<span style=\"color: rgb(183, 85, 1);\">10<\/span>}[apppool-<span style=\"color: rgb(183, 85, 1);\">1<\/span>-mixed-<span style=\"color: rgb(183, 85, 1);\">5<\/span>]\uff1a\u521d\u59cb\u7684\u672c\u5730\u503c\uff1a<span style=\"color: rgb(183, 85, 1);\">5<\/span><span style=\"color: rgb(1, 86, 146);\">@Foo<\/span>{bar=<span style=\"color: rgb(183, 85, 1);\">10<\/span>}[apppool-<span style=\"color: rgb(183, 85, 1);\">1<\/span>-mixed-<span style=\"color: rgb(183, 85, 1);\">2<\/span>]\uff1a\u521d\u59cb\u7684\u672c\u5730\u503c\uff1a<span style=\"color: rgb(183, 85, 1);\">1<\/span><span style=\"color: rgb(1, 86, 146);\">@Foo<\/span>{bar=<span style=\"color: rgb(183, 85, 1);\">10<\/span>}[apppool-<span style=\"color: rgb(183, 85, 1);\">1<\/span>-mixed-<span style=\"color: rgb(183, 85, 1);\">1<\/span>]\uff1a\u521d\u59cb\u7684\u672c\u5730\u503c\uff1a<span style=\"color: rgb(183, 85, 1);\">2<\/span><span style=\"color: rgb(1, 86, 146);\">@Foo<\/span>{bar=<span style=\"color: rgb(183, 85, 1);\">10<\/span>}[apppool-<span style=\"color: rgb(183, 85, 1);\">1<\/span>-mixed-<span style=\"color: rgb(183, 85, 1);\">1<\/span>]\uff1a\u7d2f\u52a0<span style=\"color: rgb(183, 85, 1);\">10<\/span>\u6b21\u4e4b\u540e\u7684\u672c\u5730\u503c\uff1a<span style=\"color: rgb(183, 85, 1);\">2<\/span><span style=\"color: rgb(1, 86, 146);\">@Foo<\/span>{bar=<span style=\"color: rgb(183, 85, 1);\">20<\/span>}[apppool-<span style=\"color: rgb(183, 85, 1);\">1<\/span>-mixed-<span style=\"color: rgb(183, 85, 1);\">3<\/span>]\uff1a\u7d2f\u52a0<span style=\"color: rgb(183, 85, 1);\">10<\/span>\u6b21\u4e4b\u540e\u7684\u672c\u5730\u503c\uff1a<span style=\"color: rgb(183, 85, 1);\">3<\/span><span style=\"color: rgb(1, 86, 146);\">@Foo<\/span>{bar=<span style=\"color: rgb(183, 85, 1);\">20<\/span>}[apppool-<span style=\"color: rgb(183, 85, 1);\">1<\/span>-mixed-<span style=\"color: rgb(183, 85, 1);\">5<\/span>]\uff1a\u7d2f\u52a0<span style=\"color: rgb(183, 85, 1);\">10<\/span>\u6b21\u4e4b\u540e\u7684\u672c\u5730\u503c\uff1a<span style=\"color: rgb(183, 85, 1);\">5<\/span><span style=\"color: rgb(1, 86, 146);\">@Foo<\/span>{bar=<span style=\"color: rgb(183, 85, 1);\">20<\/span>}[apppool-<span style=\"color: rgb(183, 85, 1);\">1<\/span>-mixed-<span style=\"color: rgb(183, 85, 1);\">2<\/span>]\uff1a\u7d2f\u52a0<span style=\"color: rgb(183, 85, 1);\">10<\/span>\u6b21\u4e4b\u540e\u7684\u672c\u5730\u503c\uff1a<span style=\"color: rgb(183, 85, 1);\">1<\/span><span style=\"color: rgb(1, 86, 146);\">@Foo<\/span>{bar=<span style=\"color: rgb(183, 85, 1);\">20<\/span>}[apppool-<span style=\"color: rgb(183, 85, 1);\">1<\/span>-mixed-<span style=\"color: rgb(183, 85, 1);\">4<\/span>]\uff1a\u7d2f\u52a0<span style=\"color: rgb(183, 85, 1);\">10<\/span>\u6b21\u4e4b\u540e\u7684\u672c\u5730\u503c\uff1a<span style=\"color: rgb(183, 85, 1);\">4<\/span><span style=\"color: rgb(1, 86, 146);\">@Foo<\/span>{bar=<span style=\"color: rgb(183, 85, 1);\">20<\/span>}<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u901a\u8fc7\u8f93\u51fa\u7684\u7ed3\u679c\u53ef\u4ee5\u770b\u51fa\uff0c\u5728\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\uff08LOCAL_FOO\uff09\u4e2d\uff0c\u6bcf\u4e00\u4e2a\u7ebf\u7a0b\u90fd\u7ed1\u5b9a\u4e86\u4e00\u4e2a\u72ec\u7acb\u7684\u503c\uff08Foo\u5bf9\u8c61\uff09\uff0c\u8fd9\u4e9b\u503c\u5bf9\u8c61\u662f\u7ebf\u7a0b\u7684\u79c1\u6709\u8d22\u4ea7\uff0c\u53ef\u4ee5\u7406\u89e3\u4e3a\u7ebf\u7a0b\u7684\u672c\u5730\u503c<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6bcf\u4e00\u6b21\u64cd\u4f5c\u90fd\u662f\u5728\u81ea\u5df1\u7684\u540c\u4e00\u4e2a\u672c\u5730\u503c\u4e0a\u8fdb\u884c\uff0c\u4f8b\u5b50\u4e2d\u901a\u8fc7\u7ebf\u7a0b\u672c\u5730\u503c\u7684index\u59cb\u7ec8\u4e00\u81f4\u53ef\u4ee5\u770b\u51fa\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u64cd\u4f5c\u7684\u662f\u540c\u4e00\u4e2aFoo\u5bf9\u8c61\u3002 \u5982\u679c\u7ebf\u7a0b\u5c1a\u672a\u5728\u672c\u5730\u53d8\u91cf\uff08\u5982LOCAL_FOO\uff09\u4e2d\u7ed1\u5b9a\u4e86\u4e00\u4e2a\u503c\uff0c\u76f4\u63a5\u901a\u8fc7get( )\u65b9\u6cd5\u53bb\u83b7\u53d6\u672c\u5730\u503c\uff0c\u4f1a\u83b7\u53d6\u5230\u4e00\u4e2a\u7a7a\u503c\uff0c\u6b64\u65f6\u53ef\u4ee5\u901a\u8fc7set( )\u65b9\u6cd5\u8bbe\u7f6e\u4e00\u4e2a\u503c\u4f5c\u4e3a\u521d\u59cb\u503c\uff0c\u5177\u4f53\u7684\u4ee3\u7801\u5982\u4e0b\u6240\u793a\uff1a<\/span><\/section>\n<pre data-sourcepos=\"199:1-206:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\">    <section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(101, 110, 119);\">\/\/\u83b7\u53d6\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u4e2d\u5f53\u524d\u7ebf\u7a0b\u6240\u7ed1\u5b9a\u7684\u503c<\/span>     <span style=\"color: rgb(1, 86, 146);\">if<\/span> (LOCAL_FOO.get() == <span style=\"color: rgb(1, 86, 146);\">null<\/span>)    {        <span style=\"color: rgb(101, 110, 119);\">\/\/\u8bbe\u7f6e\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u4e2d\u5f53\u524d\u7ebf\u7a0b\u6240\u7ed1\u5b9a\u7684\u521d\u59cb\u503c<\/span>        LOCAL_FOO.set(<span style=\"color: rgb(1, 86, 146);\">new<\/span> Foo());    }<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728\u5f53\u524d\u7ebf\u7a0b\u5c1a\u672a\u7ed1\u5b9a\u503c\u65f6\uff0c\u5982\u679c\u5e0c\u671b\u80fd\u4ece\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u83b7\u53d6 \u521d\u59cb\u503c\uff0c\u800c\u4e14\u4e5f\u4e0d\u60f3\u91c7\u7528\u4ee5\u4e0a\u7684\u201c\u5224\u7a7a\u540e\u8bbe\u503c\u201d\u7684\u7e41\u7410 \u65b9\u5f0f\uff0c\u5219\u53ef\u4ee5\u5728\u5b9a\u4e49\u4f7f\u7528<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocal.withInitial(\u2026)<\/span><\/code><span style=\"font-size: 15px;\">\u9759\u6001\u5de5\u5382\u65b9\u6cd5\uff0c<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4f7f\u7528ThreadLocal.withInitial(\u2026) \u7684\u65b9\u5f0f\uff0c\u53ef\u4ee5\u5728\u5b9a\u4e49ThreadLocal\u5bf9\u8c61\u65f6\u8bbe\u7f6e\u4e00\u4e2a\u83b7\u53d6\u521d\u59cb\u503c\u7684\u56de\u8c03\u51fd\u6570\uff0c\u5177\u4f53\u7684\u4ee3\u7801\u5982\u4e0b\u6240\u793a\uff1a<\/span><\/section>\n<pre data-sourcepos=\"212:1-214:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal&lt;Foo&gt; LOCAL_FOO = ThreadLocal.withInitial(() -&gt; <span style=\"color: rgb(1, 86, 146);\">new<\/span> Foo());<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4ee5\u4e0a\u4ee3\u7801\u5e76\u6ca1\u6709\u4f7f\u7528new ThreadLocal<\/span><foo><span style=\"font-size: 15px;\">()\u53bb\u6784\u9020\u4e00\u4e2aThreadLocal\u5bf9\u8c61\uff0c\u800c\u662f\u4f7f\u7528withInitial(\u2026)\u5de5\u5382\u65b9\u6cd5\u521b\u5efa\u4e00\u4e2aThreadLocal\u5bf9\u8c61\uff0c\u5e76\u4f20\u9012\u4e86\u4e00\u4e2a\u83b7\u53d6\u521d\u59cb\u503c\u7684Lamda\u56de\u8c03\u51fd\u6570\u3002<\/span><\/foo><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728\u7ebf\u7a0b\u5c1a\u672a\u7ed1\u5b9a\u503c\u800c\u76f4\u63a5\u4ece\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u83b7\u53d6\u503c\u65f6\uff0c\u5c06\u4f1a\u53d6\u5f97\u56de\u8c03\u51fd\u6570\u88ab\u8c03\u7528\u4e4b\u540e\u6240\u8fd4\u56de\u7684\u503c\u3002<\/span><\/section>\n<h3 data-sourcepos=\"220:1-220:30\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">ThreadLocal\u7684\u6210\u5458\u65b9\u6cd5<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">Java\u7a0b\u5e8f\u53ef\u4ee5\u4f7f\u7528ThreadLocal\u7684\u6210\u5458\u65b9\u6cd5\u8fdb\u884c\u672c\u5730\u503c\u64cd\u4f5c\uff0c\u5177\u4f53\u7684\u6210\u5458\u65b9\u6cd5\u5982\u4e0b\u6240\u793a\uff1a<\/span><\/section>\n<blockquote data-sourcepos=\"224:1-230:141\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<ul data-sourcepos=\"224:3-230:141\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">set(T value) \uff1a\u8bbe\u7f6e\u5f53\u524d\u7ebf\u7a0b\u5728\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u5b9e\u4f8b\u4e2d\u7ed1\u5b9a\u7684\u672c\u5730\u503c<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">T get() \uff1a\u83b7\u5f97\u5f53\u524d\u7ebf\u7a0b\u5728\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u5b9e\u4f8b\u4e2d\u7ed1\u5b9a\u7684\u672c\u5730\u503c<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">remove() \uff1a\u79fb\u9664\u5f53\u524d\u7ebf\u7a0b\u5728\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u5b9e\u4f8b\u4e2d\u7ed1\u5b9a\u7684\u672c\u5730\u503c<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">initialValue( ) \uff1a \u5f53\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u5728\u5f53\u524d\u7ebf\u7a0b\u7684ThreadLocalMap\u4e2d\u5c1a\u672a\u7ed1\u5b9a\u503c\u65f6\uff0c\u8be5\u65b9\u6cd5\u7528\u4e8e\u83b7\u53d6\u521d\u59cb\u503c\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<\/blockquote>\n<h3 data-sourcepos=\"232:1-232:36\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">ThreadLocal\u7684\u4f5c\u7528\u548c\u4f18\u52a3\u52bf<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u7684\u4f5c\u7528\u548c\u4f18\u52a3\u52bf\u4e3b\u8981\u4f53\u73b0\u5728\u4ee5\u4e0b\u51e0\u4e2a\u65b9\u9762\uff1a<\/span><\/section>\n<h5 data-sourcepos=\"236:1-236:12\" style=\"margin: 10px auto -1px;padding-left: 3px;font-weight: bold;font-size: 18px;white-space: normal;border-left-width: 10px;border-left-style: solid;border-left-color: rgb(222, 235, 255);\"><span style=\"margin-top: -1px;padding-top: 6px;padding-right: 5px;padding-left: 5px;font-size: 16px;display: inline-block;line-height: 1.1;\">\u4f5c\u7528<\/span><\/h5>\n<ol data-sourcepos=\"238:1-243:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u7ebf\u7a0b\u672c\u5730\u5b58\u50a8<\/strong>\uff1aThreadLocal\u4e3a\u6bcf\u4e2a\u7ebf\u7a0b\u63d0\u4f9b\u5404\u81ea\u7684\u53d8\u91cf\u526f\u672c\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u53ef\u4ee5\u8bfb\u53d6\u548c\u4fee\u6539\u81ea\u5df1\u7ebf\u7a0b\u7684\u672c\u5730\u53d8\u91cf\u3002\u8fd9\u610f\u5473\u7740\u5728\u591a\u7ebf\u7a0b\u73af\u5883\u4e2d\uff0c\u4e0d\u540c\u7ebf\u7a0b\u5bf9ThreadLocal\u53d8\u91cf\u7684\u64cd\u4f5c\u662f\u72ec\u7acb\u7684\uff0c\u4e0d\u4f1a\u4e92\u76f8\u5e72\u6270\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u7b80\u5316\u7ebf\u7a0b\u95f4\u6570\u636e\u4f20\u9012<\/strong>\uff1a\u901a\u8fc7\u4f7f\u7528ThreadLocal\uff0c\u53ef\u4ee5\u5c06\u67d0\u4e9b\u9700\u8981\u5728\u591a\u7ebf\u7a0b\u4e4b\u95f4\u5171\u4eab\u4f46\u53c8\u9700\u8981\u907f\u514d\u7ade\u6001\u6761\u4ef6\u7684\u6570\u636e\u5c01\u88c5\u8d77\u6765\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u8bbf\u95ee\u7684\u90fd\u662f\u81ea\u5df1\u7684\u6570\u636e\u526f\u672c\uff0c\u4ece\u800c\u7b80\u5316\u4e86\u7ebf\u7a0b\u95f4\u6570\u636e\u4f20\u9012\u7684\u590d\u6742\u6027\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u7ba1\u7406\u7ebf\u7a0b\u7279\u5b9a\u8d44\u6e90<\/strong>\uff1aThreadLocal\u5e38\u7528\u4e8e\u5b58\u50a8\u7ebf\u7a0b\u4e0a\u4e0b\u6587\u4fe1\u606f\uff0c\u5982\u7528\u6237\u4f1a\u8bdd\u4fe1\u606f\u3001\u4e8b\u52a1\u4fe1\u606f\u7b49\uff0c\u8fd9\u4e9b\u4fe1\u606f\u901a\u5e38\u4e0e\u7279\u5b9a\u7ebf\u7a0b\u5173\u8054\uff0c\u4e0d\u9700\u8981\u5728\u591a\u4e2a\u7ebf\u7a0b\u4e4b\u95f4\u5171\u4eab\u3002<\/span><\/section>\n<\/li>\n<\/ol>\n<h5 data-sourcepos=\"244:1-244:12\" style=\"margin: 10px auto -1px;padding-left: 3px;font-weight: bold;font-size: 18px;white-space: normal;border-left-width: 10px;border-left-style: solid;border-left-color: rgb(222, 235, 255);\"><span style=\"margin-top: -1px;padding-top: 6px;padding-right: 5px;padding-left: 5px;font-size: 16px;display: inline-block;line-height: 1.1;\">\u4f18\u52bf<\/span><\/h5>\n<ol data-sourcepos=\"246:1-251:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u7ebf\u7a0b\u5b89\u5168<\/strong>\uff1a\u7531\u4e8e\u6bcf\u4e2a\u7ebf\u7a0b\u64cd\u4f5c\u7684\u662f\u81ea\u5df1\u7684\u53d8\u91cf\u526f\u672c\uff0c\u56e0\u6b64\u907f\u514d\u4e86\u591a\u7ebf\u7a0b\u8bbf\u95ee\u5171\u4eab\u53d8\u91cf\u65f6\u53ef\u80fd\u51fa\u73b0\u7684\u7ade\u6001\u6761\u4ef6\u548c\u6570\u636e\u4e0d\u4e00\u81f4\u95ee\u9898\uff0c\u4ece\u800c\u4fdd\u8bc1\u4e86\u7ebf\u7a0b\u5b89\u5168\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u7b80\u5316\u7f16\u7a0b\u6a21\u578b<\/strong>\uff1a\u901a\u8fc7\u4f7f\u7528ThreadLocal\uff0c\u5f00\u53d1\u8005\u53ef\u4ee5\u66f4\u52a0\u4e13\u6ce8\u4e8e\u4e1a\u52a1\u903b\u8f91\u7684\u5b9e\u73b0\uff0c\u800c\u4e0d\u9700\u8981\u8fc7\u591a\u5173\u6ce8\u7ebf\u7a0b\u95f4\u6570\u636e\u540c\u6b65\u548c\u5171\u4eab\u7684\u95ee\u9898\uff0c\u964d\u4f4e\u4e86\u7f16\u7a0b\u590d\u6742\u5ea6\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u6027\u80fd\u4f18\u5316<\/strong>\uff1a\u7531\u4e8e\u907f\u514d\u4e86\u7ebf\u7a0b\u95f4\u6570\u636e\u540c\u6b65\u7684\u5f00\u9500\uff0c\u4ee5\u53ca\u51cf\u5c11\u4e86\u4e0d\u5fc5\u8981\u7684\u9501\u7ade\u4e89\uff0c\u56e0\u6b64\u5728\u67d0\u4e9b\u573a\u666f\u4e0b\uff0c\u4f7f\u7528ThreadLocal\u53ef\u4ee5\u63d0\u9ad8\u7cfb\u7edf\u7684\u5e76\u53d1\u6027\u80fd\u3002<\/span><\/section>\n<\/li>\n<\/ol>\n<h5 data-sourcepos=\"252:1-252:12\" style=\"margin: 10px auto -1px;padding-left: 3px;font-weight: bold;font-size: 18px;white-space: normal;border-left-width: 10px;border-left-style: solid;border-left-color: rgb(222, 235, 255);\"><span style=\"margin-top: -1px;padding-top: 6px;padding-right: 5px;padding-left: 5px;font-size: 16px;display: inline-block;line-height: 1.1;\">\u52a3\u52bf<\/span><\/h5>\n<ol data-sourcepos=\"254:1-261:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u5185\u5b58\u6d88\u8017<\/strong>\uff1aThreadLocal\u4e3a\u6bcf\u4e2a\u7ebf\u7a0b\u521b\u5efa\u53d8\u91cf\u526f\u672c\uff0c\u8fd9\u610f\u5473\u7740\u5f53\u7ebf\u7a0b\u6570\u91cf\u8f83\u591a\u65f6\uff0c\u4f1a\u5360\u7528\u8f83\u591a\u7684\u5185\u5b58\u8d44\u6e90\u3002\u7279\u522b\u662f\u5728\u957f\u65f6\u95f4\u8fd0\u884c\u7684\u7cfb\u7edf\u4e2d\uff0c\u5982\u679c\u7ebf\u7a0b\u9891\u7e41\u521b\u5efa\u548c\u9500\u6bc1\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5185\u5b58\u6cc4\u6f0f\u95ee\u9898\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u6570\u636e\u5171\u4eab\u9650\u5236<\/strong>\uff1a\u7531\u4e8eThreadLocal\u53d8\u91cf\u662f\u7ebf\u7a0b\u79c1\u6709\u7684\uff0c\u56e0\u6b64\u65e0\u6cd5\u76f4\u63a5\u5b9e\u73b0\u7ebf\u7a0b\u95f4\u7684\u6570\u636e\u5171\u4eab\u3002\u5982\u679c\u9700\u8981\u5728\u7ebf\u7a0b\u95f4\u4f20\u9012\u6570\u636e\uff0c\u53ef\u80fd\u9700\u8981\u501f\u52a9\u5176\u4ed6\u673a\u5236\uff08\u5982\u6d88\u606f\u961f\u5217\u3001\u5171\u4eab\u5185\u5b58\u7b49\uff09\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u4f7f\u7528\u4e0d\u5f53\u53ef\u80fd\u5bfc\u81f4\u5185\u5b58\u6cc4\u9732\u95ee\u9898<\/strong>\uff1a\u5982\u679c\u5f00\u53d1\u8005\u5728\u4f7f\u7528ThreadLocal\u65f6\u4e0d\u5c0f\u5fc3\u5fd8\u8bb0\u5728\u7ebf\u7a0b\u7ed3\u675f\u540e\u6e05\u7406\u53d8\u91cf\uff08\u4f8b\u5982\u901a\u8fc7\u8c03\u7528<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">remove()<\/span><\/code><span style=\"font-size: 15px;\">\u65b9\u6cd5\uff09\uff0c\u90a3\u4e48\u8fd9\u4e9b\u53d8\u91cf\u53ef\u80fd\u4f1a\u4e00\u76f4\u5b58\u5728\u4e8e\u5185\u5b58\u4e2d\uff0c\u9020\u6210\u5185\u5b58\u6cc4\u6f0f\u3002\u6b64\u5916\uff0c\u5982\u679c\u591a\u4e2a\u7ebf\u7a0b\u9700\u8981\u8bbf\u95ee\u548c\u4fee\u6539\u540c\u4e00\u4efd\u6570\u636e\uff0c\u90a3\u4e48ThreadLocal\u53ef\u80fd\u5e76\u4e0d\u9002\u5408\uff0c\u56e0\u4e3a\u5b83\u63d0\u4f9b\u7684\u662f\u6bcf\u4e2a\u7ebf\u7a0b\u79c1\u6709\u7684\u53d8\u91cf\u526f\u672c\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u6027\u80fd\u5f00\u9500<\/strong>\uff1a\u5728ThreadLocal\u4e2dThreadLocalMap \u662f\u4e00\u79cd\u4f7f\u7528\u7ebf\u6027\u63a2\u6d4b\u6cd5\u5b9e\u73b0\u7684\u54c8\u5e0c\u8868\uff0c\u5e95\u5c42\u91c7\u7528\u6570\u7ec4\u5b58\u50a8\u6570\u636e\u3002ThreadLocal.set()\/get() \u65b9\u6cd5\u5728\u6570\u636e\u5bc6\u96c6\u65f6\u5f88\u5bb9\u6613\u51fa\u73b0 Hash \u51b2\u7a81\uff0chash\u51b2\u7a81\u4f7f\u7528\u7684\u662f\u7ebf\u6027\u63a2\u6d4b\u6cd5\uff0c\u9700\u8981 O(n) \u65f6\u95f4\u590d\u6742\u5ea6\u89e3\u51b3\u51b2\u7a81\u95ee\u9898\uff0c\u6548\u7387\u8f83\u4f4e\u3002<\/span><\/section>\n<\/li>\n<\/ol>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u7efc\u4e0a\u6240\u8ff0<\/strong><\/span><\/section>\n<blockquote data-sourcepos=\"264:1-264:285\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u5728\u7b80\u5316\u7ebf\u7a0b\u95f4\u6570\u636e\u4f20\u9012\u3001\u7ba1\u7406\u7ebf\u7a0b\u7279\u5b9a\u8d44\u6e90\u548c\u63d0\u9ad8\u7ebf\u7a0b\u5b89\u5168\u6027\u65b9\u9762\u5177\u6709\u4f18\u52bf\uff0c\u4f46\u4e5f\u9700\u8981\u6ce8\u610f\u5176\u53ef\u80fd\u5e26\u6765\u7684\u5185\u5b58\u6d88\u8017\u548c\u6570\u636e\u5171\u4eab\u9650\u5236\u7b49\u95ee\u9898\u3002\u5728\u4f7f\u7528ThreadLocal\u65f6\uff0c\u5e94\u6839\u636e\u5177\u4f53\u7684\u5e94\u7528\u573a\u666f\u548c\u9700\u6c42\u8fdb\u884c\u6743\u8861\u548c\u9009\u62e9\u3002<\/span><\/section>\n<\/blockquote>\n<h3 data-sourcepos=\"266:1-266:30\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">ThreadLocal\u7684\u4f7f\u7528\u573a\u666f<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u662f\u89e3\u51b3\u7ebf\u7a0b\u5b89\u5168\u95ee\u9898\u4e00\u4e2a\u8f83\u597d\u65b9\u6848\uff0c\u5b83\u901a\u8fc7\u4e3a\u6bcf\u4e2a\u7ebf\u7a0b\u63d0\u4f9b\u4e00\u4e2a\u72ec\u7acb\u7684\u672c\u5730\u503c\uff0c\u53bb\u89e3\u51b3\u5e76\u53d1\u8bbf\u95ee\u7684\u51b2\u7a81\u95ee\u9898\u3002\u5f88\u591a\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528ThreadLocal\u6bd4\u76f4\u63a5\u4f7f\u7528\u540c\u6b65\u673a\u5236\uff08\u5982<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">synchronized<\/span><\/code><span style=\"font-size: 15px;\">\uff09\u89e3\u51b3\u7ebf\u7a0b\u5b89\u5168\u95ee\u9898\u66f4\u7b80\u5355\uff0c\u66f4\u65b9\u4fbf\uff0c\u4e14\u7ed3\u679c\u7a0b\u5e8f\u62e5\u6709\u66f4\u9ad8\u7684\u5e76\u53d1\u6027\u3002 ThreadLocal\u4f7f\u7528\u573a\u666f\uff0c\u5927\u81f4\u53ef\u4ee5\u5206\u4e3a\u4ee5\u4e0b\u4e24\u7c7b\uff1a<\/span><\/section>\n<ol data-sourcepos=\"271:1-280:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u7ebf\u7a0b\u9694\u79bb<\/strong><\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"273:4-276:0\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u7684\u4e3b\u8981\u4ef7\u503c\u5728\u4e8e\u7ebf\u7a0b\u9694\u79bb\uff0cThreadLocal\u4e2d\u6570\u636e\u53ea\u5c5e\u4e8e\u5f53\u524d\u7ebf\u7a0b\uff0c\u5176\u672c\u5730\u503c\u5bf9\u522b\u7684\u7ebf\u7a0b\u662f\u4e0d\u53ef\u89c1\u7684\uff0c\u5728\u591a\u7ebf\u7a0b\u73af\u5883\u4e0b\uff0c\u53ef\u4ee5\u9632\u6b62\u81ea\u5df1\u7684\u53d8\u91cf\u88ab\u5176\u4ed6\u7ebf\u7a0b\u7be1\u6539\u3002\u53e6\u5916\uff0c\u7531\u4e8e\u5404\u4e2a\u7ebf\u7a0b\u4e4b\u95f4\u7684\u6570\u636e\u76f8\u4e92\u9694\u79bb\uff0c\u907f\u514d\u540c\u6b65\u52a0\u9501\u5e26\u6765\u7684\u6027\u80fd\u635f\u5931\uff0c\u5927\u5927\u63d0\u5347\u4e86\u5e76\u53d1\u6027\u7684\u6027\u80fd\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u5728\u7ebf\u7a0b\u9694\u79bb\u7684\u6700\u5e38\u7528\u6848\u4f8b\u4e3a\uff1a\u53ef\u4ee5\u6bcf\u4e2a\u7ebf\u7a0b\u7ed1\u5b9a\u4e00\u4e2a\u7528\u6237\u4f1a\u8bdd\u4fe1\u606f\u3001\u6570\u636e\u5e93\u8fde\u63a5\u3001HTTP\u8bf7\u6c42\u7b49\uff0c\u8fd9\u6837\u4e00\u4e2a\u7ebf\u7a0b\u7684\u6240\u6709\u8c03\u7528\u5230\u7684\u5904\u7406\u51fd\u6570\u90fd\u53ef\u4ee5\u975e\u5e38\u65b9\u4fbf\u5730\u8bbf\u95ee\u8fd9\u4e9b\u8d44\u6e90\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5e38\u89c1\u7684ThreadLocal\u4f7f\u7528\u573a\u666f\u4e3a\u6570\u636e\u5e93\u8fde\u63a5\u72ec\u4eab\u3001Session\u6570\u636e\u7ba1\u7406\u7b49\u573a\u666f\u5728\u201c\u7ebf\u7a0b\u9694\u79bb\u201d\u573a\u666f\u4e2d\u4f7f\u7528ThreadLocal\u7684\u5178\u578b\u6848\u4f8b\u4e3a\uff1a\u53ef\u4ee5\u6bcf\u4e2a\u7ebf\u7a0b\u7ed1\u5b9a\u4e00\u4e2a\u6570\u636e\u5e93\u8fde\u63a5\uff0c\u662f\u7684\u8fd9\u4e2a\u6570\u636e\u5e93\u8fde\u63a5\u4e3a\u7ebf\u7a0b\u6240\u72ec\u4eab\uff0c\u4ece\u800c\u907f\u514d\u6570\u636e\u5e93\u8fde\u63a5\u88ab\u6df7\u7528\u800c\u5bfc\u81f4\u64cd\u4f5c\u5f02\u5e38\u95ee\u9898\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u8de8\u51fd\u6570\u4f20\u9012\u6570\u636e<\/strong><\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"279:4-280:0\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u901a\u5e38\u7528\u4e8e\u540c\u4e00\u4e2a\u7ebf\u7a0b\u5185\uff0c\u8de8\u7c7b\u3001\u8de8\u65b9\u6cd5\u4f20\u9012\u6570\u636e\u65f6\uff0c\u5982\u679c\u4e0d\u7528ThreadLocal\uff0c\u90a3\u4e48\u76f8\u4e92\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u9012\u52bf\u5fc5\u8981\u9760\u8fd4\u56de\u503c\u548c\u53c2\u6570\uff0c\u8fd9\u6837\u65e0\u5f62\u4e4b\u4e2d\u589e\u52a0\u4e86\u8fd9\u4e9b\u7c7b\u6216\u8005\u65b9\u6cd5\u4e4b\u95f4\u7684\u8026\u5408\u5ea6\u3002\u3001<\/span><\/section>\n<\/li>\n<\/ul>\n<\/ol>\n<h3 data-sourcepos=\"281:1-281:49\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">\u573a\u666f1\uff1a\u4f7f\u7528ThreadLocal\u8fdb\u884c\u7ebf\u7a0b\u9694\u79bb<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u5728\u201c\u7ebf\u7a0b\u9694\u79bb\u201d\u5e94\u7528\u573a\u666f\u7684\u5178\u578b\u5e94\u7528\u4e3a\u201c\u6570\u636e\u5e93\u8fde\u63a5\u72ec\u4eab\u201d\u3002\u4e0b\u9762\u7684\u4ee3\u7801\u6765\u81eaHibernate\uff0c\u4ee3\u7801\u4e2d\u901a\u8fc7ThreadLocal\u8fdb\u884c\u6570\u636e\u5e93\u8fde\u63a5\uff08Session\uff09\u7684\u201c\u7ebf\u7a0b\u672c\u5730\u5316\u201d\u5b58\u50a8\uff0c\u4e3b\u8981\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"285:1-300:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> ThreadLocal threadSession = <span style=\"color: rgb(1, 86, 146);\">new<\/span> ThreadLocal();  <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> Session <span style=\"color: rgb(183, 85, 1);\">getSession<\/span>() <span style=\"color: rgb(1, 86, 146);\">throws<\/span> InfrastructureException {      Session s = (Session) threadSession.get();      <span style=\"color: rgb(1, 86, 146);\">try<\/span> {          <span style=\"color: rgb(1, 86, 146);\">if<\/span> (s == <span style=\"color: rgb(1, 86, 146);\">null<\/span>) {              s = getSessionFactory().openSession();              threadSession.set(s);          }      } <span style=\"color: rgb(1, 86, 146);\">catch<\/span> (HibernateException ex) {          <span style=\"color: rgb(1, 86, 146);\">throw<\/span> <span style=\"color: rgb(1, 86, 146);\">new<\/span> InfrastructureException(ex);      }      <span style=\"color: rgb(1, 86, 146);\">return<\/span> s;  }  <\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">Hibernate<\/span><\/code><span style=\"font-size: 15px;\">\u5bf9\u6570\u636e\u5e93\u8fde\u63a5\u8fdb\u884c\u4e86\u5c01\u88c5\uff0c\u4e00\u4e2aSession \u4ee3\u8868\u4e00\u4e2a\u6570\u636e\u5e93\u8fde\u63a5\u3002\u901a\u8fc7\u4ee5\u4e0a\u4ee3\u7801\u53ef\u4ee5\u770b\u5230\uff0c<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728Hibernate\u7684getSession()\u65b9\u6cd5\u4e2d\uff0c\u9996\u5148\u5224\u65ad\u5f53\u524d\u7ebf\u7a0b\u4e2d\u6709\u6ca1\u6709\u653e\u8fdb\u53bbsession\uff0c<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5982\u679c\u8fd8\u6ca1\u6709\uff0c\u90a3\u4e48\u901a\u8fc7sessionFactory().openSession()\u6765\u521b\u5efa\u4e00\u4e2aSession \uff0c\u518d\u5c06Session \u8bbe\u7f6e\u5230ThreadLocal\u53d8\u91cf\u4e2d\uff0c\u8fd9\u4e2aSession \u76f8\u5f53\u4e8e\u7ebf\u7a0b\u7684\u79c1\u6709\u53d8\u91cf\uff0c\u800c\u4e0d\u662f\u6240\u6709\u7ebf\u7a0b\u5171\u7528\u7684\uff0c\u663e\u7136\u5176\u4ed6\u7ebf\u7a0b\u4e2d\u662f\u53d6\u4e0d\u5230\u8fd9\u4e2aSession\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e00\u822c\u6765\u8bf4\uff0c\u5b8c\u6210\u6570\u636e\u5e93\u64cd\u4f5c\u4e4b\u540e\u7a0b\u5e8f\u4f1a\u5c06<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">Session<\/span><\/code><span style=\"font-size: 15px;\">\u5173\u95ed\uff0c\u4ece\u800c\u8282\u7701\u6570\u636e\u5e93\u8fde\u63a5\u8d44\u6e90\u3002\u5982\u679cSession\u7684\u4f7f\u7528\u65b9\u5f0f\u4e3a\u5171\u4eab\u800c\u4e0d\u662f\u72ec\u5360\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0cSession\u662f\u591a\u7ebf\u7a0b\u5171\u4eab\u4f7f\u7528\u7684\uff0c\u5982\u679c\u67d0\u4e2a\u7ebf\u7a0b\u4f7f\u7528\u5b8c\u6210\u4e4b\u540e\uff0c\u76f4\u63a5\u5c06Session\u5173\u95ed\uff0c\u5176\u4ed6\u7ebf\u7a0b\u5728\u64cd\u4f5cSession\u5c31\u4f1a\u62a5\u9519\u3002\u6240\u4ee5Hibernate\u901a\u8fc7ThreadLocal\u975e\u5e38\u7b80\u5355\u5b9e\u73b0\u4e86\u6570\u636e\u5e93\u8fde\u63a5\u7684\u5b89\u5168\u4f7f\u7528\u3002<\/span><\/section>\n<h3 data-sourcepos=\"312:1-312:58\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">\u573a\u666f2\uff1a\u4f7f\u7528ThreadLocal\u8fdb\u884c\u8de8\u51fd\u6570\u6570\u636e\u4f20\u9012<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u5728\u201c<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u8de8\u51fd\u6570\u6570\u636e\u4f20\u9012<\/span><\/code><span style=\"font-size: 15px;\">\u201d\u5e94\u7528\u573a\u666f\u7684\u5178\u578b\u6709\u5f88\u591a\uff1a<\/span><\/section>\n<blockquote data-sourcepos=\"316:1-322:55\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<ul data-sourcepos=\"316:3-322:55\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7528\u6765\u4f20\u9012\u8bf7\u6c42\u8fc7\u7a0b\u4e2d\u7684\u7528\u6237ID\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7528\u6765\u4f20\u9012\u8bf7\u6c42\u8fc7\u7a0b\u4e2d\u7684\u7528\u6237\u4f1a\u8bdd\uff08Session\uff09\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7528\u6765\u4f20\u9012HTTP\u7684\u7528\u6237\u8bf7\u6c42\u5b9e\u4f8bHttpRequest\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5176\u4ed6\u9700\u8981\u5728\u51fd\u6570\u4e4b\u95f4\u9891\u7e41\u4f20\u9012\u7684\u6570\u636e\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<\/blockquote>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4ee5\u4e0b\u4ee3\u7801\u6765\u81ea\u4e8e\u75af\u72c2\u521b\u5ba2\u5708\u793e\u7fa4\u7684\u5fae\u670d\u52a1\u811a\u624b\u67b6<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">Crazy-SpringCloud<\/span><\/code><span style=\"font-size: 15px;\">\u5de5\u7a0b\uff0c\u901a\u8fc7ThreadLocal\u5728\u51fd\u6570\u4e4b\u95f4\u4f20\u9012\u7528\u6237\u4fe1\u606f\u3001\u4f1a\u8bdd\u4fe1\u606f\u7b49\uff0c\u5e76\u4e14\u5c01\u88c5\u6210\u4e86\u4e00\u4e2a\u72ec\u7acb\u7684SessionHolder\u7c7b\uff0c\u5177\u4f53\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"326:1-363:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">package<\/span> com.crazymaker.springcloud.common.context;...\u7701\u7565<span style=\"color: rgb(1, 86, 146);\">import<\/span><span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">class<\/span> <span style=\"color: rgb(183, 85, 1);\">SessionHolder<\/span>{    <span style=\"color: rgb(101, 110, 119);\">\/\/ session id  \u7ebf\u7a0b\u672c\u5730\u53d8\u91cf<\/span>    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> ThreadLocal&lt;String&gt; sidLocal =                                          <span style=\"color: rgb(1, 86, 146);\">new<\/span> ThreadLocal&lt;&gt;(<span style=\"color: rgb(84, 121, 13);\">\"sidLocal\"<\/span>);    <span style=\"color: rgb(101, 110, 119);\">\/\/ \u7528\u6237\u4fe1\u606f  \u7ebf\u7a0b\u672c\u5730\u53d8\u91cf<\/span>    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> ThreadLocal&lt;UserDTO&gt; sessionUserLocal =                                           <span style=\"color: rgb(1, 86, 146);\">new<\/span> ThreadLocal&lt;&gt;(<span style=\"color: rgb(84, 121, 13);\">\"sessionUserLocal\"<\/span>);    <span style=\"color: rgb(101, 110, 119);\">\/\/ session  \u7ebf\u7a0b\u672c\u5730\u53d8\u91cf<\/span>    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> ThreadLocal&lt;HttpSession&gt; sessionLocal =                                               <span style=\"color: rgb(1, 86, 146);\">new<\/span> ThreadLocal&lt;&gt;(<span style=\"color: rgb(84, 121, 13);\">\"sessionLocal\"<\/span>);...\u7701\u7565\u5176\u4ed6      <span style=\"color: rgb(101, 110, 119);\">\/**     *\u4fdd\u5b58session\u5728\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u4e2d      *\/<\/span>    <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">setSession<\/span>(HttpSession session)    {        sessionLocal.set(session);    }    <span style=\"color: rgb(101, 110, 119);\">\/**     * \u53d6\u5f97\u7ed1\u5b9a\u5728\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u4e2d\u7684session       *\/<\/span>    <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> HttpSession <span style=\"color: rgb(183, 85, 1);\">getSession<\/span>()    {        HttpSession session = sessionLocal.get();        Assert.notNull(session, <span style=\"color: rgb(84, 121, 13);\">\"session \u672a\u8bbe\u7f6e\"<\/span>);        <span style=\"color: rgb(1, 86, 146);\">return<\/span> session;    }    ...\u7701\u7565\u5176\u4ed6  }<\/span><\/section><\/pre>\n<h3 data-sourcepos=\"367:1-367:50\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">\u573a\u666f3\uff1aThreadLocal\u5728Java\u6846\u67b6\u4e2d\u7684\u5e94\u7528<\/span><\/h3>\n<ol data-sourcepos=\"369:1-387:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-2\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>Spring<\/strong><\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"370:4-371:208\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728Spring\u6846\u67b6\u4e2d\uff0cThreadLocal\u7528\u4e8e\u5b58\u50a8\u6570\u636e\u5e93\u8fde\u63a5\u7b49\u7ebf\u7a0b\u7279\u5b9a\u7684\u8d44\u6e90\u3002\u7531\u4e8e\u6570\u636e\u5e93\u8fde\u63a5\u662f\u7ebf\u7a0b\u4e0d\u5b89\u5168\u7684\uff0c\u56e0\u6b64\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u9700\u8981\u6709\u81ea\u5df1\u7684\u8fde\u63a5\u526f\u672c\u3002Spring\u901a\u8fc7ThreadLocal\u5c06\u6570\u636e\u5e93\u8fde\u63a5\u4e0e\u5f53\u524d\u7ebf\u7a0b\u5173\u8054\u8d77\u6765\uff0c\u4ece\u800c\u907f\u514d\u4e86\u591a\u7ebf\u7a0b\u73af\u5883\u4e0b\u7684\u6570\u636e\u7ade\u4e89\u548c\u4e0d\u4e00\u81f4\u95ee\u9898\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728Spring\u7684\u4e8b\u52a1\u7ba1\u7406\u4e2d\uff0cThreadLocal\u4e5f\u626e\u6f14\u7740\u91cd\u8981\u89d2\u8272\u3002\u5b83\u786e\u4fdd\u4e86\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u81ea\u5df1\u7684\u4e8b\u52a1\u4e0a\u4e0b\u6587\uff0c\u5305\u62ec\u4e8b\u52a1\u72b6\u6001\u3001\u56de\u6eda\u70b9\u7b49\u4fe1\u606f\uff0c\u4ece\u800c\u5b9e\u73b0\u4e86\u4e8b\u52a1\u7684\u9694\u79bb\u6027\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>MyBatis<\/strong><\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"373:4-373:409\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">MyBatis\u662f\u4e00\u4e2a\u4f18\u79c0\u7684\u6301\u4e45\u5c42\u6846\u67b6\uff0c\u5b83\u652f\u6301\u5b9a\u5236\u5316SQL\u3001\u5b58\u50a8\u8fc7\u7a0b\u4ee5\u53ca\u9ad8\u7ea7\u6620\u5c04\u3002\u5728MyBatis\u4e2d\uff0cThreadLocal\u53ef\u4ee5\u7528\u6765\u5b58\u50a8SqlSession\u5bf9\u8c61\u3002\u7531\u4e8eSqlSession\u4e0d\u662f\u7ebf\u7a0b\u5b89\u5168\u7684\uff0c\u56e0\u6b64\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u5e94\u8be5\u62e5\u6709\u81ea\u5df1\u72ec\u7acb\u7684SqlSession\u5b9e\u4f8b\u3002\u901a\u8fc7ThreadLocal\uff0cMyBatis\u53ef\u4ee5\u65b9\u4fbf\u5730\u5b9e\u73b0SqlSession\u7684\u7ebf\u7a0b\u5c40\u90e8\u5b58\u50a8\uff0c\u786e\u4fdd\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u80fd\u6b63\u786e\u5730\u6267\u884cSQL\u64cd\u4f5c\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u5206\u5e03\u5f0f\u7cfb\u7edf<\/strong><\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"375:4-375:281\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\uff0cThreadLocal\u53ef\u4ee5\u7528\u6765\u4f20\u9012\u5168\u5c40ID\u548c\u5206\u652fID\u7b49\u5173\u952e\u4fe1\u606f\u3002\u8fd9\u4e9bID\u5bf9\u4e8e\u5206\u5e03\u5f0f\u4e8b\u52a1\u7684\u8ffd\u8e2a\u548c\u8bca\u65ad\u81f3\u5173\u91cd\u8981\u3002\u901a\u8fc7\u5c06\u8fd9\u4e9bID\u5b58\u50a8\u5728ThreadLocal\u4e2d\uff0c\u53ef\u4ee5\u786e\u4fdd\u5b83\u4eec\u5728\u6574\u4e2a\u8bf7\u6c42\u5904\u7406\u8fc7\u7a0b\u4e2d\u90fd\u80fd\u88ab\u6b63\u786e\u4f20\u9012\u548c\u4f7f\u7528\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u65e5\u5fd7\u6846\u67b6<\/strong><\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"377:4-377:285\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e00\u4e9b\u65e5\u5fd7\u6846\u67b6\u4e5f\u5229\u7528ThreadLocal\u6765\u5b58\u50a8\u4e0e\u5f53\u524d\u7ebf\u7a0b\u76f8\u5173\u7684\u65e5\u5fd7\u4e0a\u4e0b\u6587\u4fe1\u606f\uff0c\u5982\u7528\u6237ID\u3001\u64cd\u4f5c\u7c7b\u578b\u7b49\u3002\u8fd9\u6837\uff0c\u5728\u8bb0\u5f55\u65e5\u5fd7\u65f6\uff0c\u53ef\u4ee5\u65b9\u4fbf\u5730\u83b7\u53d6\u8fd9\u4e9b\u4fe1\u606f\uff0c\u5e76\u5c06\u5176\u6dfb\u52a0\u5230\u65e5\u5fd7\u6761\u76ee\u4e2d\uff0c\u4ece\u800c\u65b9\u4fbf\u540e\u7eed\u7684\u65e5\u5fd7\u5206\u6790\u548c\u6392\u67e5\u95ee\u9898\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>RPC<\/strong><\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"379:4-379:333\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728\u8fdc\u7a0b\u8fc7\u7a0b\u8c03\u7528\uff08RPC\uff09\u6846\u67b6\u4e2d\uff0cThreadLocal\u7528\u4e8e\u5b58\u50a8\u548c\u4f20\u9012\u4e0e\u5f53\u524d\u8c03\u7528\u76f8\u5173\u7684\u4e0a\u4e0b\u6587\u4fe1\u606f\u3002\u8fd9\u4e9b\u4e0a\u4e0b\u6587\u4fe1\u606f\u53ef\u80fd\u5305\u62ec\u8c03\u7528\u8005\u7684\u8eab\u4efd\u3001\u8c03\u7528\u7684\u53c2\u6570\u3001\u8d85\u65f6\u8bbe\u7f6e\u7b49\u3002\u901a\u8fc7\u5c06\u8fd9\u4e9b\u4fe1\u606f\u5b58\u50a8\u5728ThreadLocal\u4e2d\uff0c\u53ef\u4ee5\u786e\u4fdd\u5b83\u4eec\u5728RPC\u8c03\u7528\u8fc7\u7a0b\u4e2d\u80fd\u591f\u88ab\u6b63\u786e\u5730\u4f20\u9012\u548c\u4f7f\u7528\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>Hibernate<\/strong><\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"381:4-382:125\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>SessionContext<\/strong>: \u7528\u4e8e\u5b58\u50a8\u5f53\u524d\u7ebf\u7a0b\u7684Hibernate\u4f1a\u8bdd\u76f8\u5173\u6570\u636e\uff0c\u5982\u5f53\u524d\u4f1a\u8bdd\u3001\u6301\u4e45\u5316\u4e0a\u4e0b\u6587\u7b49\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>TransactionManager<\/strong>: \u7ba1\u7406\u4e8b\u52a1\u72b6\u6001\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u53ef\u4ee5\u6709\u72ec\u7acb\u7684\u4e8b\u52a1\u72b6\u6001\uff0c\u5982\u5f53\u524d\u662f\u5426\u5728\u4e8b\u52a1\u4e2d\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>Tomcat<\/strong><\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"384:4-384:142\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>ThreadLocal\u53d8\u91cf<\/strong>: \u7528\u4e8e\u8ddf\u8e2a\u6bcf\u4e2a\u8bf7\u6c42\u7684\u4f1a\u8bdd\u4fe1\u606f\u3001\u7528\u6237\u8ba4\u8bc1\u6570\u636e\u7b49\uff0c\u786e\u4fdd\u8fd9\u4e9b\u6570\u636e\u4e0d\u4f1a\u5728\u8bf7\u6c42\u4e4b\u95f4\u5171\u4eab\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>Kafka<\/strong><\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"386:4-387:0\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>Producer and Consumer Threads<\/strong>: \u5728\u6d88\u606f\u751f\u4ea7\u548c\u6d88\u8d39\u8fc7\u7a0b\u4e2d\uff0c\u4f7f\u7528ThreadLocal\u6765\u5b58\u50a8\u7ebf\u7a0b\u7279\u5b9a\u7684\u914d\u7f6e\u548c\u72b6\u6001\u4fe1\u606f\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<\/ol>\n<h3 data-sourcepos=\"388:1-388:33\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">ThreadLocal\u7efc\u5408\u4f7f\u7528\u6848\u4f8b<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7531\u4e8eThreadLocal\u4f7f\u7528\u4e0d\u5f53\u4f1a\u5bfc\u81f4\u4e25\u91cd\u7684\u5185\u5b58\u6cc4\u6f0f\uff0c\u6240\u4ee5\u4e3a\u4e86\u66f4\u597d\u7684\u907f\u514d\u5185\u5b58\u6cc4\u6f0f\u7684\u53d1\u751f\uff0c\u6211\u4eec\u4f7f\u7528ThreadLocal\u65f6\u9075\u5b88\u4ee5\u4e0b\u4e24\u4e2a\u539f\u5219\uff1a<\/span><\/section>\n<ol data-sourcepos=\"392:1-398:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5c3d\u91cf\u4f7f\u7528private static final\u4fee\u9970ThreadLocal\u5b9e\u4f8b\u3002\u4f7f\u7528 private \u4e0efinal \u4fee\u9970\u7b26\uff0c\u4e3b\u8981\u662f\u5c3d\u53ef\u80fd\u4e0d\u8ba9\u4ed6\u4eba\u4fee\u6539\u3001\u53d8\u66f4ThreadLocal\u53d8\u91cf\u7684\u5f15\u7528\uff1b \u4f7f\u7528static \u4fee\u9970\u7b26\u4e3b\u8981\u4e3a\u4e86\u786e\u4fddThreadLocal\u5b9e\u4f8b\u7684\u5168\u5c40\u552f\u4e00\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u4f7f\u7528\u5b8c\u6210\u4e4b\u540e\u52a1\u5fc5\u8c03\u7528remove\u65b9\u6cd5\u3002\u8fd9\u662f\u7b80\u5355\u3001\u6709\u6548\u5730\u907f\u514dThreadLocal\u5f15\u53d1\u5185\u5b58\u6cc4\u6f0f\u7684\u65b9\u6cd5\u3002<\/span><\/section>\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e0b\u9762\u7528\u4e00\u4e2a\u7efc\u5408\u6848\u4f8b\u6f14\u793a\u4e00\u4e0bThreadLocal\u7684\u4f7f\u7528\u3002\u6b64\u6848\u4f8b\u7684\u529f\u80fd\u4e3a\uff1a\u8bb0\u5f55\u6267\u884c\u8fc7\u7a0b\u4e2d\u6240\u8c03\u7528\u7684\u51fd\u6570\u7684\u6267\u884c\u8017\u65f6\u3002\u6bd4\u5982\u5728\u5b9e\u9645Web\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u4e00\u6b21\u5ba2\u6237\u7aef\u8bf7\u6c42\u5f80\u5f80\u4f1a\u6d89\u53ca\u5230DB\u3001\u7f13\u5b58\u3001RPC\u7b49\u591a\u4e2a\u8017\u65f6\u8c03\u7528\uff0c\u4e00\u65e6\u51fa\u73b0\u6027\u80fd\u95ee\u9898\uff0c\u5c31\u9700\u8981\u8bb0\u5f55\u4e00\u4e0b\u5404\u4e2a\u70b9\u8017\u65f6\u7684\u65f6\u95f4\uff0c\u4ece\u800c\u5224\u65ad\u6027\u80fd\u7684\u74f6\u9888\u6240\u5728\u3002 \u4e0b\u9762\u7684\u4ee3\u7801\u5b9a\u4e49\u4e86\u4e09\u4e2a\u65b9\u6cd5<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">serviceMethod<\/span><\/code><span style=\"font-size: 15px;\">\u3001<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">daoMethod<\/span><\/code><span style=\"font-size: 15px;\">\u3001<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">rpcMethod<\/span><\/code><span style=\"font-size: 15px;\">\uff0c\u7528\u4e8e\u6a21\u62df\u5b9e\u9645\u7684DB\u3001RPC\u7b49\u8017\u65f6\u8c03\u7528\uff0c\u5177\u4f53\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/span><\/section>\n<\/li>\n<\/ol>\n<pre data-sourcepos=\"399:1-447:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">package<\/span> com.crazymakercircle.mutithread.basic.threadlocal;...\u7701\u7565<span style=\"color: rgb(1, 86, 146);\">import<\/span><span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">class<\/span> <span style=\"color: rgb(183, 85, 1);\">ThreadLocalTest2<\/span>{    <span style=\"color: rgb(101, 110, 119);\">\/**     * \u6a21\u62df\u4e1a\u52a1\u65b9\u6cd5     *\/<\/span>    <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">serviceMethod<\/span>()    {        <span style=\"color: rgb(101, 110, 119);\">\/\/\u7761\u7720500ms,\u6a21\u62df\u6267\u884c\u8017\u65f6<\/span>        sleepMilliSeconds(<span style=\"color: rgb(183, 85, 1);\">500<\/span>);        <span style=\"color: rgb(101, 110, 119);\">\/\/\u8bb0\u5f55\u4ece\u5f00\u59cb\u8c03\u7528\u5230\u5f53\u524d\u8fd9\u4e2a\u70b9\uff08 \"point-1\"\uff09\u7684\u8017\u65f6<\/span>        SpeedLog.logPoint(<span style=\"color: rgb(84, 121, 13);\">\"point-1 service\"<\/span>);        <span style=\"color: rgb(101, 110, 119);\">\/\/\u8c03\u7528DAO\u65b9\u6cd5\uff1a\u6a21\u62dfdao\u4e1a\u52a1\u65b9\u6cd5<\/span>        daoMethod();        <span style=\"color: rgb(101, 110, 119);\">\/\/\u8c03\u7528RPC\u65b9\u6cd5\uff1a\u6a21\u62dfRPC\u8fdc\u7a0b\u4e1a\u52a1\u65b9\u6cd5<\/span>        rpcMethod();    }    <span style=\"color: rgb(101, 110, 119);\">\/**     * \u6a21\u62dfdao\u4e1a\u52a1\u65b9\u6cd5     *\/<\/span>    <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">daoMethod<\/span>()    {        <span style=\"color: rgb(101, 110, 119);\">\/\/\u7761\u7720400ms,\u6a21\u62df\u6267\u884c\u8017\u65f6<\/span>        sleepMilliSeconds(<span style=\"color: rgb(183, 85, 1);\">400<\/span>);        <span style=\"color: rgb(101, 110, 119);\">\/\/\u8bb0\u5f55\u4e0a\u4e00\u4e2a\u70b9\uff08\"point-1\"\uff09\u8fd9\u91cc\uff08\"point-2\"\uff09\u7684\u8017\u65f6<\/span>        SpeedLog.logPoint(<span style=\"color: rgb(84, 121, 13);\">\"point-2 dao\"<\/span>);    }    <span style=\"color: rgb(101, 110, 119);\">\/**     * \u6a21\u62dfRPC\u8fdc\u7a0b\u4e1a\u52a1\u65b9\u6cd5     *\/<\/span>    <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">rpcMethod<\/span>()    {        <span style=\"color: rgb(101, 110, 119);\">\/\/\u7761\u7720400ms,\u6a21\u62df\u6267\u884c\u8017\u65f6<\/span>        sleepMilliSeconds(<span style=\"color: rgb(183, 85, 1);\">600<\/span>);        <span style=\"color: rgb(101, 110, 119);\">\/\/\u8bb0\u5f55\u4e0a\u4e00\u4e2a\u70b9\uff08\"point-2\"\uff09\u8fd9\u91cc\uff08\"point-3\"\uff09\u7684\u8017\u65f6<\/span>        SpeedLog.logPoint(<span style=\"color: rgb(84, 121, 13);\">\"point-3 rpc\"<\/span>);    }    ...\u7701\u7565\u4e0d\u76f8\u5e72\u4ee3\u7801}<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e3a\u4e86\u80fd\u7075\u6d3b\u5730\u8bb0\u5f55\u5404\u4e2a\u6267\u884c\u57cb\u70b9\u7684\u8017\u65f6\uff0c\u8fd9\u91cc\u5b9a\u4e49\u4e86\u4e00\u4e2aSpeedLog\u7c7b\u3002\u8be5\u7c7b\u542b\u6709\u4e00\u4e2aThreadLocal\u7c7b\u578b\u7684\u3001\u521d\u59cb\u503c\u4e3a\u4e00\u4e2aMap&lt;String, Long&gt;\u5b9e\u4f8b\u7684\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\uff0c\u540d\u5b57\u53eb\u505aTIME_RECORD_LOCAL\u3002 \u5982\u679c\u8981\u8bb0\u5f55\u67d0\u4e2a\u51fd\u6570\u7684\u8c03\u7528\u8017\u65f6\uff0c\u5c31\u9700\u8981\u8fdb\u884c\u8017\u65f6\u57cb\u70b9\uff0c\u5177\u4f53\u7684\u65b9\u6cd5\u4e3alogPoint(String point)\u3002\u8be5\u65b9\u6cd5\u4f1a\u64cd\u4f5cTIME_RECORD_LOCAL\u672c\u5730\u53d8\u91cf\uff0c\u5728\u5176\u4e2d\u589e\u52a0\u4e00\u6b21\u8017\u65f6\u8bb0\u5f55\uff1aKey\u4e3a\u8017\u65f6\u57cb\u70b9\u7684\u540d\u79f0\uff0c\u503c\u4e3a\u5f53\u524d\u65f6\u95f4\u548c\u4e0a\u4e00\u6b21\u8bb0\u5f55\u65f6\u95f4\u7684\u5dee\u503c\uff0c\u4e5f\u5c31\u662f\u4e0a\u4e00\u6b21\u57cb\u70b9\u5230\u672c\u6b21\u57cb\u70b9\u4e4b\u95f4\u7684\u8c03\u7528\u8017\u65f6\u3002 SpeedLog\u7c7b\u7684\u4ee3\u7801\uff0c\u5927\u81f4\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"453:1-511:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">package<\/span> com.crazymakercircle.mutithread.basic.threadlocal;...\u7701\u7565<span style=\"color: rgb(1, 86, 146);\">import<\/span><span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">class<\/span> <span style=\"color: rgb(183, 85, 1);\">SpeedLog<\/span>{    <span style=\"color: rgb(101, 110, 119);\">\/**     * \u8bb0\u5f55\u8c03\u7528\u8017\u65f6\u7684\u672c\u5730Map\u53d8\u91cf     *\/<\/span><span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> ThreadLocal&lt;Map&lt;String, Long&gt;&gt; TIME_RECORD_LOCAL =ThreadLocal.withInitial(SpeedLog::initialStartTime);    <span style=\"color: rgb(101, 110, 119);\">\/**     * \u8bb0\u5f55\u8c03\u7528\u8017\u65f6\u7684\u672c\u5730Map\u53d8\u91cf\u7684\u521d\u59cb\u5316\u65b9\u6cd5     *\/<\/span>    <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> Map&lt;String, Long&gt; <span style=\"color: rgb(183, 85, 1);\">initialStartTime<\/span>()    {        Map&lt;String, Long&gt; map = <span style=\"color: rgb(1, 86, 146);\">new<\/span> HashMap&lt;&gt;();        map.put(<span style=\"color: rgb(84, 121, 13);\">\"start\"<\/span>, System.currentTimeMillis());        map.put(<span style=\"color: rgb(84, 121, 13);\">\"last\"<\/span>, System.currentTimeMillis());        <span style=\"color: rgb(1, 86, 146);\">return<\/span> map;    }    <span style=\"color: rgb(101, 110, 119);\">\/**     * \u5f00\u59cb\u8017\u65f6\u8bb0\u5f55     *\/<\/span>    <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">beginSpeedLog<\/span>()    {        Print.fo(<span style=\"color: rgb(84, 121, 13);\">\"\u5f00\u59cb\u8017\u65f6\u8bb0\u5f55\"<\/span>);        TIME_RECORD_LOCAL.get();    }    <span style=\"color: rgb(101, 110, 119);\">\/**     * \u7ed3\u675f\u8017\u65f6\u8bb0\u5f55     *\/<\/span>    <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">endSpeedLog<\/span>()    {        TIME_RECORD_LOCAL.remove();        Print.fo(<span style=\"color: rgb(84, 121, 13);\">\"\u7ed3\u675f\u8017\u65f6\u8bb0\u5f55\"<\/span>);    }    <span style=\"color: rgb(101, 110, 119);\">\/**     * \u8017\u65f6\u57cb\u70b9     *\/<\/span>    <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">logPoint<\/span>(String point)    {        <span style=\"color: rgb(101, 110, 119);\">\/\/\u83b7\u53d6\u4e0a\u4e00\u6b21\u7684\u65f6\u95f4<\/span>        Long last = TIME_RECORD_LOCAL.get().get(<span style=\"color: rgb(84, 121, 13);\">\"last\"<\/span>);        <span style=\"color: rgb(101, 110, 119);\">\/\/\u8ba1\u7b97\u4e0a\u4e00\u6b21\u57cb\u70b9\u5230\u5f53\u524d\u57cb\u70b9\u7684\u8017\u65f6<\/span>        Long cost = System.currentTimeMillis() - last;        <span style=\"color: rgb(101, 110, 119);\">\/\/\u4fdd\u5b58\u4e0a\u4e00\u6b21\u57cb\u70b9\u5230\u5f53\u524d\u57cb\u70b9\u7684\u8017\u65f6<\/span>        TIME_RECORD_LOCAL.get().put(point + <span style=\"color: rgb(84, 121, 13);\">\" cost:\"<\/span>, cost);         <span style=\"color: rgb(101, 110, 119);\">\/\/\u4fdd\u5b58\u5f53\u524d\u65f6\u95f4\uff0c\u4f9b\u4e0b\u4e00\u6b21\u57cb\u70b9\u4f7f\u7528<\/span>        TIME_RECORD_LOCAL.get().put(<span style=\"color: rgb(84, 121, 13);\">\"last\"<\/span>, System.currentTimeMillis());    }    ...\u7701\u7565\u4e0d\u76f8\u5e72\u4ee3\u7801}<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e0b\u9762\u662f\u4e00\u4e2a\u6d4b\u8bd5\u7528\u4f8b\uff0c\u6f14\u793a\u4e00\u4e0b\u5728 serviceMethod\u3001daoMethod\u3001rpcMethod\u4e09\u4e2a\u6a21\u62df\u65b9\u6cd5\u7684\u8c03\u7528\u8fc7\u7a0b\u4e2d\uff0c\u5176\u8017\u65f6\u7684\u8bb0\u5f55\u548c\u8f93\u51fa\uff0c\u5177\u4f53\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"515:1-544:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">package<\/span> com.crazymakercircle.mutithread.basic.threadlocal;...\u7701\u7565<span style=\"color: rgb(1, 86, 146);\">import<\/span><span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">class<\/span> <span style=\"color: rgb(183, 85, 1);\">ThreadLocalTest2<\/span>{    <span style=\"color: rgb(101, 110, 119);\">\/**     * \u6d4b\u8bd5\u7528\u4f8b\uff1a\u7ebf\u7a0b\u65b9\u6cd5\u8c03\u7528\u7684\u8017\u65f6     *\/<\/span>    <span style=\"color: rgb(1, 86, 146);\">@org<\/span>.junit.Test    <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">testSpeedLog<\/span>() <span style=\"color: rgb(1, 86, 146);\">throws<\/span> InterruptedException    {        Runnable runnable = () -&gt;        {            <span style=\"color: rgb(101, 110, 119);\">\/\/\u5f00\u59cb\u8017\u65f6\u8bb0\u5f55\uff0c\u4fdd\u5b58\u5f53\u524d\u65f6\u95f4<\/span>            SpeedLog.beginSpeedLog();            <span style=\"color: rgb(101, 110, 119);\">\/\/\u8c03\u7528\u6a21\u62df\u4e1a\u52a1\u65b9\u6cd5<\/span>            serviceMethod();            <span style=\"color: rgb(101, 110, 119);\">\/\/\u6253\u5370\u8017\u65f6<\/span>             SpeedLog.printCost();            <span style=\"color: rgb(101, 110, 119);\">\/\/\u7ed3\u675f\u8017\u65f6\u8bb0\u5f55<\/span>            SpeedLog.endSpeedLog();        };        <span style=\"color: rgb(1, 86, 146);\">new<\/span> Thread(runnable).start();        sleepSeconds(<span style=\"color: rgb(183, 85, 1);\">10<\/span>);<span style=\"color: rgb(101, 110, 119);\">\/\/\u7b49\u5f8510s\u770b\u7ed3\u679c<\/span>    }    ...\u7701\u7565\u4e0d\u76f8\u5e72\u4ee3\u7801}<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd0\u884c\u4ee5\u4e0a\u7528\u4f8b\uff0c\u4e09\u4e2a\u6a21\u62df\u65b9\u6cd5 serviceMethod\u3001daoMethod\u3001rpcMethod\u7684\u8017\u65f6\u8f93\u51fa\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"548:1-556:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\">[SpeedLog.beginSpeedLog]\uff1a\u5f00\u59cb\u8017\u65f6\u8bb0\u5f55[SpeedLog.printCost]\uff1astart =&gt;<span style=\"color: rgb(183, 85, 1);\">1600347227334<\/span>[SpeedLog.printCost]\uff1apoint-<span style=\"color: rgb(183, 85, 1);\">1<\/span> service cost: =&gt;<span style=\"color: rgb(183, 85, 1);\">500<\/span>[SpeedLog.printCost]\uff1apoint-<span style=\"color: rgb(183, 85, 1);\">2<\/span> dao cost: =&gt;<span style=\"color: rgb(183, 85, 1);\">401<\/span>[SpeedLog.printCost]\uff1apoint-<span style=\"color: rgb(183, 85, 1);\">3<\/span> rpc cost: =&gt;<span style=\"color: rgb(183, 85, 1);\">600<\/span>[SpeedLog.printCost]\uff1alast =&gt;<span style=\"color: rgb(183, 85, 1);\">1600347228835<\/span>[SpeedLog.endSpeedLog]\uff1a\u7ed3\u675f\u8017\u65f6\u8bb0\u5f55<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4ee5\u4e0a\u6848\u4f8b\u4e2d\uff0c\u5c06ThreadLocal\u53d8\u91cf\u58f0\u660e\u6210\u4e3a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">private static final<\/span><\/code><span style=\"font-size: 15px;\">\u7684\u5f62\u5f0f\uff0c\u4f7f\u5f97\u5916\u90e8\u4e0d\u80fd\u76f4\u63a5\u8bbf\u95ee\uff0c\u5916\u90e8\u80fd\u8bbf\u95ee\u7684\u662f\u5c06ThreadLocal\u53d8\u91cf\u5c01\u88c5\u4e4b\u540e\u7684\u63a5\u53e3\u51fd\u6570\u5982beginSpeedLog( )\u3001logPoint(String point)\u3001endSpeedLog( )\u7b49\u7b49\u3002 \u603b\u4e4b\uff0c\u4f7f\u7528ThreadLocal\u80fd\u5b9e\u73b0\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u4e00\u4efd\u53d8\u91cf\u7684\u672c\u5730\u503c\uff0c\u5176\u539f\u56e0\u662f\u7531\u4e8e\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u6709\u81ea\u5df1\u72ec\u7acb\u7684ThreadLocalMap\u7a7a\u95f4\uff0c\u672c\u8d28\u4e0a\u5c5e\u4e8e\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u7684\u8bbe\u8ba1\u601d\u8def\uff0c\u8be5\u8bbe\u8ba1\u601d\u8def\u5c5e\u4e8e\u4e86\u53e6\u4e00\u79cd\u610f\u4e49\u7684 \u201c\u65e0\u9501\u7f16\u7a0b\u201d\u3002<\/span><\/section>\n<h3 data-sourcepos=\"561:1-561:28\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">ThreadLocal \u4f7f\u7528\u603b\u7ed3<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u603b\u7ed3\u8d77\u6765\uff0cThreadLocal\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u7684\u5e94\u7528\u5e7f\u6cdb\u4e14\u5b9e\u7528\uff0c\u4f46\u540c\u65f6\u4e5f\u9700\u6ce8\u610f\u5176\u6f5c\u5728\u7684\u98ce\u9669\u548c\u6311\u6218\u3002\u901a\u8fc7\u9075\u5faa\u6700\u4f73\u5b9e\u8df5\uff0c\u5408\u7406\u8bbe\u8ba1\u548c\u7ba1\u7406ThreadLocal\u53d8\u91cf\uff0c\u6211\u4eec\u80fd\u591f\u5728\u591a\u7ebf\u7a0b\u73af\u5883\u4e0b\u9ad8\u6548\u5730\u89e3\u51b3\u6570\u636e\u9694\u79bb\u95ee\u9898\uff0c\u540c\u65f6\u4fdd\u6301\u4ee3\u7801\u7b80\u6d01\u6613\u61c2\uff0c\u786e\u4fdd\u7cfb\u7edf\u7a33\u5b9a\u6027\u548c\u9ad8\u6027\u80fd\u8fd0\u884c\u3002<\/span><\/section>\n<h2 data-sourcepos=\"567:1-567:29\" style=\"font-weight: bold;font-size: 22px;margin: 10px auto 5px;border-top-width: 1px;border-top-style: solid;border-top-color: rgb(242, 242, 242);background-color: rgb(242, 242, 242);\"><span style=\"margin-top: -1px;padding-top: 14px;padding-bottom: 14px;padding-right: 5px;padding-left: 5px;font-size: 17px;border-top: 4px solid rgb(33, 33, 34);display: inline-block;line-height: 1.5;font-weight: normal;background-color: rgb(30, 30, 30);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 20px;padding-left: 10px;\">ThreadLocal\u7684\u5b9e\u73b0\u539f\u7406<\/span><\/h2>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728\u65e9\u671f\u7684JDK\u7248\u672c\u4e2d\uff0cThreadLocal\u7684\u5185\u90e8\u7ed3\u6784\u662f\u4e00\u4e2aMap\uff0c\u5176\u4e2d\u6bcf\u4e00\u4e2a\u7ebf\u7a0b\u5b9e\u4f8b\u4f5c\u4e3aKey\uff0c\u7ebf\u7a0b\u5728\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u4e2d\u7ed1\u5b9a\u7684\u503c\u4e3aValue\uff08\u672c\u5730\u503c\uff09\u3002\u65e9\u671f\u7248\u672c\u4e2d\u7684Map\u7ed3\u6784\uff0c\u5176\u62e5\u6709\u8005\u4e3aThreadLocal\uff0c\u6bcf\u4e00\u4e2aThreadLocal\u5b9e\u4f8b\uff0c\u62e5\u6709\u4e00\u4e2aMap\u5b9e\u4f8b\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728JDK8\u7248\u672c\u4e2d\uff0cThreadLocal\u7684\u5185\u90e8\u7ed3\u6784\u53d1\u751f\u4e86\u6f14\u8fdb\uff0c\u867d\u7136\u8fd8\u662f\u4f7f\u7528\u4e86Map\u7ed3\u6784\uff0c\u4f46\u662fMap\u7ed3\u6784\u7684\u62e5\u6709\u8005\u5df2\u7ecf\u53d1\u751f\u4e86\u53d8\u5316\uff0c\u5176\u62e5\u6709\u8005\u4e3aThread\uff08\u7ebf\u7a0b\uff09\u5b9e\u4f8b\uff0c\u6bcf\u4e00\u4e2aThread\u5b9e\u4f8b\uff0c\u62e5\u6709\u4e00\u4e2aMap\u5b9e\u4f8b\u3002\u53e6\u5916\uff0cMap\u7ed3\u6784\u7684Key\u503c\u4e5f\u53d1\u751f\u4e86\u53d8\u5316\uff1a\u65b0\u7684Key\u4e3aThreadLocal\u5b9e\u4f8b\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728JDK8\u7248\u672c\u4e2d\uff0c\u6bcf\u4e00\u4e2aThread\u7ebf\u7a0b\u5185\u90e8\u90fd\u6709\u4e00\u4e2aMap(ThreadLocalMap)\uff0c\u56e0\u4e3a\u5982\u6211\u4eec\u7ed9\u4e00\u4e2aThread\u521b\u5efa\u591a\u4e2aThreadlocal\u5b9e\u5217\uff0c\u7136\u4e4e\u653e\u7f6e\u672c\u5730\u6570\u636e\uff0c\u90a3\u4e48\u5f53\u524d\u7ebf\u7a0b\u7684ThreadLocalMap\u4e2d\u5c31\u4f1a\u6709\u591a\u4e2a\u201cKey-Value\u5bf9\u201d\uff0c\u5176\u4e2dThreadLocal\u5b9e\u4f8b\u4e3akey\uff0c\u672c\u5730\u6570\u636e\u4e3aValue\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728\u4ee3\u7801\u7684\u5c42\u9762\u6765\u8bf4\uff0c\u65b0\u7248\u672c\u7684ThreadLocalMap\u8fd8\u662f\u7531ThreadLocal\u7c7b\u7ef4\u62a4\u7684\uff0c\u7531ThreadLocal\u8d1f\u8d23ThreadLocalMap\u5b9e\u4f8b\u7684\u83b7\u53d6\u3001\u521b\u5efa\uff0c\u5e76\u4ece\u4e2d\u8bbe\u7f6e\u672c\u5730\u503c\u3001\u83b7\u53d6\u672c\u5730\u503c\u3002\u6240\u4ee5ThreadLocalMap\u8fd8\u5bc4\u5b58\u4e8eThreadLocal\u5185\u90e8\uff0c\u800c\u5e76\u6ca1\u6709\u88ab\u8fc1\u79fb\u5230Thread\u5185\u90e8\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u5185\u90e8\u4f7f\u7528ThreadLocalMap\u6765\u4fdd\u5b58\u6bcf\u4e2a\u7ebf\u7a0b\u7684\u53d8\u91cf\u526f\u672c\u3002\u6bcf\u4e2aThread\u90fd\u6301\u6709\u4e00\u4e2aThreadLocalMap\u7684\u5f15\u7528\uff0c\u8fd9\u4e2amap\u7684key\u662fThreadLocal\u5b9e\u4f8b\u672c\u8eab\uff0cvalue\u662f\u7ebf\u7a0b\u53d8\u91cf\u526f\u672c\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5f53\u7ebf\u7a0b\u9996\u6b21\u8c03\u7528ThreadLocal\u7684get()\u6216set()\u65b9\u6cd5\u65f6\uff0cThreadLocalMap\u4f1a\u88ab\u521b\u5efa\u5e76\u5173\u8054\u5230\u5f53\u524d\u7ebf\u7a0b\u3002\u6b64\u540e\uff0c\u7ebf\u7a0b\u5c31\u53ef\u4ee5\u901a\u8fc7ThreadLocal\u5b9e\u4f8b\u7684get()\u548cset()\u65b9\u6cd5\u8bbf\u95ee\u81ea\u5df1\u7684\u7ebf\u7a0b\u5c40\u90e8\u53d8\u91cf\u4e86\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7b80\u5355\u6765\u8bf4\uff1aThreadLocal \u5c31\u662f\u4e00\u79cd\u4ee5<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u7a7a\u95f4\u6362\u65f6\u95f4<\/span><\/code><span style=\"font-size: 15px;\">\u7684\u505a\u6cd5\uff0c\u5728\u6bcf\u4e2a Thread \u91cc\u9762\u7ef4\u62a4\u4e86\u4e00\u4e2a\u4ee5\u5f00\u653e\u5b9a\u5740\u6cd5\u5b9e\u73b0\u7684ThreadLocal.ThreadLocalMap\uff0c\u628a\u6570\u636e\u8fdb\u884c\u9694\u79bb\uff0c\u6570\u636e\u4e0d\u5171\u4eab\uff0c\u81ea\u7136\u5c31\u6ca1\u6709\u7ebf\u7a0b\u5b89\u5168\u65b9\u9762\u7684\u95ee\u9898\u4e86\u3002<\/span><\/section>\n<h3 data-sourcepos=\"585:1-585:33\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">ThreadLocal\u5185\u90e8\u7ed3\u6784\u6f14\u8fdb<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728\u65e9\u671f\u7684JDK\u7248\u672c\u4e2d\uff0cThreadLocal\u7684\u5185\u90e8\u7ed3\u6784\u662f\u4e00\u4e2aMap\uff0c\u5176\u4e2d\u6bcf\u4e00\u4e2a\u7ebf\u7a0b\u5b9e\u4f8b\u4f5c\u4e3aKey\uff0c\u7ebf\u7a0b\u5728\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u4e2d\u7ed1\u5b9a\u7684\u503c\u4e3aValue\uff08\u672c\u5730\u503c\uff09\u3002\u65e9\u671f\u7248\u672c\u4e2d\u7684Map\u7ed3\u6784\uff0c\u5176\u62e5\u6709\u8005\u4e3a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocal<\/span><\/code><span style=\"font-size: 15px;\">\uff0c\u6bcf\u4e00\u4e2aThreadLocal\u5b9e\u4f8b\uff0c\u62e5\u6709\u4e00\u4e2a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">Map<\/span><\/code><span style=\"font-size: 15px;\">\u5b9e\u4f8b\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">JDK1.7\u7684<span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">ThreadLocalMap \u5185\u90e8\u7ed3\u6784\uff0c\u5927\u81f4\u5982\u4e0b\uff1a<\/span><\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018209\" data-ratio=\"0.6305555555555555\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142829694.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018209\" data-ratio=\"0.6305555555555555\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142829694.png\"  \/><\/noscript><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728JDK8\u7248\u672c\u4e2d\uff0cThreadLocal\u7684\u5185\u90e8\u7ed3\u6784\u53d1\u751f\u4e86\u6f14\u8fdb\uff0c\u867d\u7136\u8fd8\u662f\u4f7f\u7528\u4e86Map\u7ed3\u6784\uff0c\u4f46\u662fMap\u7ed3\u6784\u7684\u62e5\u6709\u8005\u5df2\u7ecf\u53d1\u751f\u4e86\u53d8\u5316\uff0c\u5176\u62e5\u6709\u8005\u4e3a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">Thread\uff08\u7ebf\u7a0b\uff09\u5b9e\u4f8b<\/span><\/code><span style=\"font-size: 15px;\">\uff0c\u6bcf\u4e00\u4e2aThread\u5b9e\u4f8b\uff0c\u62e5\u6709\u4e00\u4e2a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">Map<\/span><\/code><span style=\"font-size: 15px;\">\u5b9e\u4f8b\u3002\u53e6\u5916\uff0cMap\u7ed3\u6784\u7684Key\u503c\u4e5f\u53d1\u751f\u4e86\u53d8\u5316\uff1a\u65b0\u7684<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">Key\u4e3aThreadLocal\u5b9e\u4f8b<\/span><\/code><span style=\"font-size: 15px;\">\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">JDK1.8\u7684<\/span><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">ThreadLocalMap \u5185\u90e8\u7ed3\u6784\uff0c\u5927\u81f4\u5982\u4e0b\uff1a<\/span><\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018210\" data-ratio=\"0.6370370370370371\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142833101.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018210\" data-ratio=\"0.6370370370370371\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142833101.png\"  \/><\/noscript><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728JDK8\u7248\u672c\u4e2d\uff0c\u6bcf\u4e00\u4e2aThread\u7ebf\u7a0b\u5185\u90e8\u90fd\u6709\u4e00\u4e2aMap(<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocalMap<\/span><\/code><span style=\"font-size: 15px;\">)\uff0c\u56e0\u4e3a\u5982\u6211\u4eec\u7ed9\u4e00\u4e2aThread\u521b\u5efa\u591a\u4e2aThreadlocal\u5b9e\u5217\uff0c\u7136\u4e4e\u653e\u7f6e\u672c\u5730\u6570\u636e\uff0c\u90a3\u4e48\u5f53\u524d\u7ebf\u7a0b\u7684ThreadLocalMap\u4e2d\u5c31\u4f1a\u6709\u591a\u4e2a\u201cKey-Value\u5bf9\u201d\uff0c\u5176\u4e2d<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocal\u5b9e\u4f8b\u4e3akey<\/span><\/code><span style=\"font-size: 15px;\">\uff0c<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u672c\u5730\u6570\u636e\u4e3aValue<\/span><\/code><span style=\"font-size: 15px;\">\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728\u4ee3\u7801\u7684\u5c42\u9762\u6765\u8bf4\uff0c\u65b0\u7248\u672c\u7684ThreadLocalMap\u8fd8\u662f\u7531ThreadLocal\u7c7b\u7ef4\u62a4\u7684\uff0c\u7531ThreadLocal\u8d1f\u8d23ThreadLocalMap\u5b9e\u4f8b\u7684\u83b7\u53d6\u3001\u521b\u5efa\uff0c\u5e76\u4ece\u4e2d\u8bbe\u7f6e\u672c\u5730\u503c\u3001\u83b7\u53d6\u672c\u5730\u503c\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6240\u4ee5\u5728\u4ee3\u7801\u7ef4\u5ea6\uff0cThreadLocalMap\u8fd8\u5bc4\u5b58\u4e8eThreadLocal\u5185\u90e8\uff0c\u800c\u5e76\u6ca1\u6709\u88ab\u8fc1\u79fb\u5230Thread\u5185\u90e8\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u901a\u8fc7<span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">ThreadLocalMa<\/span><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">p\uff0c<\/span>\u6bcf\u4e00\u4e2athread\u7ebf\u7a0b\u5728\u83b7\u53d6\u672c\u5730\u503c\u65f6\uff0c\u5c06ThreadLocal\u5b9e\u4f8b\u4f5c\u4e3aKey\u4ece\u81ea\u5df1\u62e5\u6709\u7684ThreadLocalMap\u4e2d\u83b7\u53d6\u503c\uff0c\u522b\u7684\u7ebf\u7a0b\u65e0\u6cd5\u8bbf\u95ee\u81ea\u5df1\u7684ThreadLocalMap\u5b9e\u4f8b\uff0c\u81ea\u5df1\u4e5f\u65e0\u6cd5\u8bbf\u95ee\u522b\u4ebaThreadLocalMap\u5b9e\u4f8b\uff0c\u8fbe\u5230\u76f8\u4e92\u9694\u79bb\uff0c\u4e92\u4e0d\u5e72\u6270\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">jdk1.8\u7248\u672cThreadLocalMap \u4e0e\u65e9\u671f\u7248\u672c\u7684ThreadLocalMap\u5b9e\u73b0\u76f8\u6bd4\uff0c\u4e3b\u8981\u7684\u53d8\u5316\u4e3a\uff1a<\/span><\/section>\n<ul data-sourcepos=\"609:1-612:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u62e5\u6709\u8005\u53d1\u751f\u4e86\u53d8\u5316<\/strong>\uff1a\u65b0\u7248\u672c\u7684ThreadLocalMap\u62e5\u6709\u8005\u4e3a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">Thread<\/span><\/code><span style=\"font-size: 15px;\">\uff0c\u65e9\u671f\u7248\u672c\u7684ThreadLocalMap\u62e5\u6709\u8005\u4e3a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocal<\/span><\/code><span style=\"font-size: 15px;\">\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>Key\u53d1\u751f\u4e86\u53d8\u5316<\/strong>\uff1a\u65b0\u7248\u672c\u7684Key\u4e3a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocal<\/span><\/code><span style=\"font-size: 15px;\">\u5b9e\u4f8b\uff0c\u65e9\u671f\u7248\u672c\u7684Key\u4e3a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">Thread<\/span><\/code><span style=\"font-size: 15px;\">\u5b9e\u4f8b\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">jdk1.8\u7248\u672cThreadLocalMap \u4e0e\u65e9\u671f\u7248\u672c\u7684ThreadLocalMap\u5b9e\u73b0\u76f8\u6bd4\uff0c<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u65b0\u7248\u672c\u7684\u4e3b\u8981\u4f18\u52bf\u4e3a<\/span><\/code><span style=\"font-size: 15px;\">\uff1a<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\uff081\uff09<strong>\u6bcf\u4e2aThreadLocalMap\u5b58\u50a8\u7684\u201cKey-Value\u5bf9\u201d\u6570\u91cf\u53d8\u5c11<\/strong>\u3002<\/span><\/section>\n<ul data-sourcepos=\"617:1-620:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u65e9\u671f\u7248\u672c\u7684\u201cKey-Value\u5bf9\u201d\u6570\u91cf\u4e0e\u7ebf\u7a0b\u4e2a\u6570\u5f3a\u5173\u8054\uff0c\u5982\u679c\u7ebf\u7a0b\u6570\u91cf\u591a\uff0c\u5219ThreadLocalMap\u5b58\u50a8\u201cKey-Value\u5bf9\u201d\u6570\u91cf\u4e5f\u591a\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u65b0\u7248\u672c\u7684ThreadLocalMap\u7684Key \u4e3aThreadLocal\u5b9e\u4f8b\uff0c\u591a\u7ebf\u7a0b\u60c5\u51b5\u4e0bThreadLocal\u5b9e\u4f8b\u6bd4\u7ebf\u7a0b\u6570\u5c11\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\uff082\uff09<strong>ThreadLocalMap\u62e5\u6709\u8005\u4e3aThread\uff0c\u964d\u4f4e\u5185\u5b58\u6d88\u8017<\/strong>\u3002<\/span><\/section>\n<ul data-sourcepos=\"623:1-625:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u65e9\u671f\u7248\u672cThreadLocalMap\u7684\u62e5\u6709\u8005\u4e3aThreadLocal\uff0c\u5728Thread\uff08\u7ebf\u7a0b\uff09\u5b9e\u4f8b\u9500\u6bc1\u540e\uff0cThreadLocalMap\u8fd8\u662f\u5b58\u5728\u7684\uff1b<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u65b0\u7248\u672c\u7684ThreadLocalMap\u7684\u62e5\u6709\u8005\u4e3aThread\uff0c\u73b0\u5728\u5f53Thread\u5b9e\u4f8b\u9500\u6bc1\u540e\uff0cThreadLocalMap\u4e5f\u4f1a\u968f\u4e4b\u9500\u6bc1\uff0c\u5728\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u80fd\u51cf\u5c11\u5185\u5b58\u7684\u6d88\u8017\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<h3 data-sourcepos=\"626:1-626:41\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">ThreadLocalMap\u5bf9\u8c61\u548cEntry\u662f\u4ec0\u4e48<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u7684\u64cd\u4f5c\u90fd\u662f\u57fa\u4e8e<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocalMap<\/span><\/code><span style=\"font-size: 15px;\">\u5c55\u5f00\u7684\uff0c\u800c<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocalMap<\/span><\/code><span style=\"font-size: 15px;\">\u662fThreadLocal\u7684\u4e00\u4e2a\u9759\u6001\u5185\u90e8\u7c7b\uff0c\u5176\u5b9e\u73b0\u4e86\u4e00\u5957\u7b80\u5355\u7684Map\u7ed3\u6784\uff08\u6bd4HashMap\u7b80\u5355\uff09\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocalMap\u5185\u90e8\u7ef4\u62a4Entry\u6570\u7ec4\uff0c\u4f5c\u4e3aThreadLocalMap\u6761\u76ee\u6570\u7ec4\uff0c\u4f5c\u4e3a\u6563\u5217\u8868\u4f7f\u7528\uff0c\u5982\u4e0b\u56fe\uff1a<\/span><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018211\" data-ratio=\"0.6105263157894737\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1045\" style=\"text-align: center;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142837900.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018211\" data-ratio=\"0.6105263157894737\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1045\" style=\"text-align: center;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142837900.png\"  \/><\/noscript><\/section>\n<h3 data-sourcepos=\"636:1-636:30\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">ThreadLocal\u7684\u7ed3\u6784\u6a21\u578b<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4ee5jdk1.8\u7684ThreadLocal \u4e3a\u6807\u51c6\uff0c \u603b\u7ed3\u4e00\u4e0b ThreadLocal\u7684\u7ed3\u6784\u6a21\u578b\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6bcf\u4e2aThread\u90fd\u6709\u4e00\u4e2a ThreadLocalMap \u7ed3\u6784\uff0c\u5176\u4e2d\u5c31\u4fdd\u5b58\u7740\u5f53\u524d\u7ebf\u7a0b\u6240\u6301\u6709\u7684\u6240\u6709 ThreadLocal\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal \u672c\u8eab\u53ea\u662f\u4e00\u4e2a\u5f15\u7528\uff0c\u6ca1\u6709\u76f4\u63a5\u4fdd\u5b58\u503c\uff0c\u503c\u662f\u4fdd\u5b58\u5728 ThreadLocalMap \u4e2d\uff0cThreadLocal \u4f5c\u4e3a key\uff0c\u503c\uff08\u5b9e\u9645\u4fdd\u5b58\u7684\u6570\u636e\uff09\u4f5c\u4e3a value\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u53ef\u4ee5\u7528\u4e0b\u9762\u7684\u56fe\u6765\u6982\u62ec\uff1a<\/span><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018212\" data-ratio=\"0.5462962962962963\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142840487.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018212\" data-ratio=\"0.5462962962962963\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142840487.png\"  \/><\/noscript><\/section>\n<h3 data-sourcepos=\"652:1-652:27\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">ThreadLocal\u6e90\u7801\u5206\u6790<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u7684\u6e90\u7801\u63d0\u4f9b\u7684\u65b9\u6cd5\u4e0d\u591a\uff0c\u4e3b\u8981\u7684\u65b9\u6cd5\u6709\uff1a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">set(T value)\u65b9\u6cd5<\/span><\/code><span style=\"font-size: 15px;\">\u3001<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">get( )\u65b9\u6cd5<\/span><\/code><span style=\"font-size: 15px;\">\u3001<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">remove( )\u65b9\u6cd5<\/span><\/code><span style=\"font-size: 15px;\">\u3001<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">initialValue( )\u65b9\u6cd5<\/span><\/code><span style=\"font-size: 15px;\">\u3002<\/span><\/section>\n<h4 data-sourcepos=\"656:1-656:23\" style=\"margin: 10px auto -1px;padding-left: 3px;font-weight: bold;font-size: 18px;white-space: normal;border-left-width: 10px;border-left-style: solid;border-left-color: rgb(222, 235, 255);\"><span style=\"margin-top: -1px;padding-top: 6px;padding-right: 5px;padding-left: 5px;font-size: 16px;display: inline-block;line-height: 1.1;\">set(T value)\u65b9\u6cd5<\/span><\/h4>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">set(T value)\u65b9\u6cd5<\/span><\/code><span style=\"font-size: 15px;\">\u7528\u4e8e\u8bbe\u7f6e\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u5728\u5f53\u524d\u7ebf\u7a0b\u7684ThreadLocalMap\u4e2d\u5bf9\u5e94\u7684\u503c\uff0c\u76f8\u5f53\u4e8e\u8bbe\u7f6e\u7ebf\u7a0b\u672c\u5730\u503c\uff0c\u5176\u6838\u5fc3\u6e90\u7801\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"660:1-692:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\">    <section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">set<\/span>(T value) {        <span style=\"color: rgb(101, 110, 119);\">\/\/\u83b7\u53d6\u5f53\u524d\u7ebf\u7a0b\u5bf9\u8c61<\/span>        Thread t = Thread.currentThread();         <span style=\"color: rgb(101, 110, 119);\">\/\/\u83b7\u53d6\u5f53\u524d\u7ebf\u7a0b\u7684ThreadLocalMap \u6210\u5458<\/span>        ThreadLocalMap map = getMap(t);        <span style=\"color: rgb(101, 110, 119);\">\/\/\u5224\u65admap\u662f\u5426\u5b58\u5728<\/span>        <span style=\"color: rgb(1, 86, 146);\">if<\/span> (map != <span style=\"color: rgb(1, 86, 146);\">null<\/span>)         {                 <span style=\"color: rgb(101, 110, 119);\">\/\/value\u88ab\u7ed1\u5b9a\u5230threadLocal\u5b9e\u4f8b<\/span>            map.set(<span style=\"color: rgb(1, 86, 146);\">this<\/span>, value);           }        <span style=\"color: rgb(1, 86, 146);\">else<\/span>        {            <span style=\"color: rgb(101, 110, 119);\">\/\/ \u5982\u679c\u5f53\u524d\u7ebf\u7a0b\u6ca1\u6709ThreadLocalMap\u6210\u5458\u5b9e\u4f8b<\/span>            <span style=\"color: rgb(101, 110, 119);\">\/\/ \u521b\u5efa\u4e00\u4e2aThreadLocalMap\u5b9e\u4f8b\uff0c\u7136\u540e\uff0c\u4f5c\u4e3a\u6210\u5458\u5173\u8054\u5230t\uff08thread\u5b9e\u4f8b\uff09<\/span>            createMap(t, value);        }    }    <span style=\"color: rgb(101, 110, 119);\">\/\/ \u83b7\u53d6\u7ebf\u7a0bt\u7684ThreadLocalMap\u6210\u5458<\/span>    ThreadLocalMap <span style=\"color: rgb(183, 85, 1);\">getMap<\/span>(Thread t) {        <span style=\"color: rgb(1, 86, 146);\">return<\/span> t.threadLocals;    }    <span style=\"color: rgb(101, 110, 119);\">\/\/ \u7ebf\u7a0bt\u521b\u5efa\u4e00\u4e2aThreadLocalMap\u6210\u5458<\/span>    <span style=\"color: rgb(101, 110, 119);\">\/\/\u5e76\u4e3a\u65b0\u7684Map\u6210\u5458\u8bbe\u7f6e\u7b2c\u4e00\u4e2aKey-Value\u5bf9\uff0cKey\u4e3a\u5f53\u524d\u7684ThreadLocal\u5b9e\u4f8b<\/span>    <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">createMap<\/span>(Thread t, T firstValue) {        t.threadLocals = <span style=\"color: rgb(1, 86, 146);\">new<\/span> ThreadLocalMap(<span style=\"color: rgb(1, 86, 146);\">this<\/span>, firstValue);    }<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u901a\u8fc7\u4ee5\u4e0a\u7684\u6e90\u7801\uff0c\u53ef\u4ee5\u770b\u51fa<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">set(T value)\u65b9\u6cd5<\/span><\/code><span style=\"font-size: 15px;\">\u7684\u6267\u884c\u6d41\u7a0b\uff0c\u5927\u81f4\u5982\u4e0b\uff1a<\/span><\/section>\n<blockquote data-sourcepos=\"696:1-698:160\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<ul data-sourcepos=\"696:3-698:160\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u83b7\u5f97\u5f53\u524d\u7ebf\u7a0b\uff0c\u7136\u540e\u83b7\u5f97\u5f53\u524d\u7ebf\u7a0b\u7684ThreadLocalMap\u6210\u5458\uff0c\u6682\u5b58\u4e8emap\u53d8\u91cf\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5982\u679cmap\u4e0d\u4e3a\u7a7a\uff0c\u5219\u5c06Value\u8bbe\u7f6e\u5230map\u4e2d\uff0c\u5f53\u524d\u7684Threadlocal\u4f5c\u4e3akey\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5982\u679cmap\u4e3a\u7a7a\uff0c\u7ed9\u8be5\u7ebf\u7a0b\u521b\u5efamap\uff0c\u7136\u540e\u8bbe\u7f6e\u7b2c\u4e00\u4e2a\u201cKey-Value\u5bf9\u201d\uff0cKey\u4e3a\u5f53\u524d\u7684ThreadLocal\u5b9e\u4f8b\uff0cValue\u4e3aset\u65b9\u6cd5\u7684\u53c2\u6570value\u503c\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<\/blockquote>\n<h4 data-sourcepos=\"700:1-700:17\" style=\"margin: 10px auto -1px;padding-left: 3px;font-weight: bold;font-size: 18px;white-space: normal;border-left-width: 10px;border-left-style: solid;border-left-color: rgb(222, 235, 255);\"><span style=\"margin-top: -1px;padding-top: 6px;padding-right: 5px;padding-left: 5px;font-size: 16px;display: inline-block;line-height: 1.1;\">get( )\u65b9\u6cd5<\/span><\/h4>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">get( )\u65b9\u6cd5<\/span><\/code><span style=\"font-size: 15px;\">\u7528\u4e8e\u83b7\u53d6\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u5728\u5f53\u524d\u7ebf\u7a0b\u7684<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocalMap<\/span><\/code><span style=\"font-size: 15px;\">\u4e2d\u5bf9\u5e94\u7684\u503c\uff0c\u76f8\u5f53\u4e8e\u83b7\u53d6\u7ebf\u7a0b\u672c\u5730\u503c\uff0c\u5176\u6838\u5fc3\u6e90\u7801\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"704:1-738:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">public<\/span> T <span style=\"color: rgb(183, 85, 1);\">get<\/span>() {    <span style=\"color: rgb(101, 110, 119);\">\/\/\u83b7\u5f97\u5f53\u524d\u7ebf\u7a0b\u5bf9\u8c61<\/span>    Thread t = Thread.currentThread();    <span style=\"color: rgb(101, 110, 119);\">\/\/\u83b7\u5f97\u7ebf\u7a0b\u5bf9\u8c61\u7684ThreadLocalMap \u5185\u90e8\u6210\u5458<\/span>    ThreadLocalMap map = getMap(t);   <span style=\"color: rgb(101, 110, 119);\">\/\/ \u5982\u679c\u5f53\u524d\u7ebf\u7a0b\u7684\u5185\u90e8map\u6210\u5458\u5b58\u5728<\/span>   <span style=\"color: rgb(1, 86, 146);\">if<\/span> (map != <span style=\"color: rgb(1, 86, 146);\">null<\/span>) {        <span style=\"color: rgb(101, 110, 119);\">\/\/ \u4ee5\u5f53\u524dthreadlocal\u4e3aKey,\u5c1d\u8bd5\u83b7\u5f97\u6761\u76ee<\/span>        ThreadLocalMap.Entry e = map.getEntry(<span style=\"color: rgb(1, 86, 146);\">this<\/span>);       <span style=\"color: rgb(101, 110, 119);\">\/\/ \u6761\u76ee\u5b58\u5728<\/span>        <span style=\"color: rgb(1, 86, 146);\">if<\/span> (e != <span style=\"color: rgb(1, 86, 146);\">null<\/span>) {            T result = (T)e.value;            <span style=\"color: rgb(1, 86, 146);\">return<\/span> result;        }    }    <span style=\"color: rgb(101, 110, 119);\">\/\/ \u5982\u679c\u5f53\u524d\u7ebf\u7a0b\u5bf9\u5e94map\u4e0d\u5b58\u5728<\/span>    <span style=\"color: rgb(101, 110, 119);\">\/\/\u6216\u8005map\u5b58\u5728\uff0c\u4f46\u662f\u5f53\u524dthreadlocal\u5b9e\u4f8b\u6ca1\u6709\u5bf9\u5e94\u7684Key-Value\uff0c\u8fd4\u56de\u521d\u59cb\u503c<\/span>    <span style=\"color: rgb(1, 86, 146);\">return<\/span> setInitialValue();}<span style=\"color: rgb(101, 110, 119);\">\/\/ \u8bbe\u7f6ethreadlocal\u5173\u8054\u7684\u521d\u59cb\u503c\u5e76\u8fd4\u56de<\/span><span style=\"color: rgb(1, 86, 146);\">private<\/span> T <span style=\"color: rgb(183, 85, 1);\">setInitialValue<\/span>() {    <span style=\"color: rgb(101, 110, 119);\">\/\/\u8c03\u7528\u521d\u59cb\u5316\u94a9\u5b50\u51fd\u6570\uff0c\u83b7\u53d6\u521d\u59cb\u503c<\/span>    T value = initialValue();    Thread t = Thread.currentThread();    ThreadLocalMap map = getMap(t);    <span style=\"color: rgb(1, 86, 146);\">if<\/span> (map != <span style=\"color: rgb(1, 86, 146);\">null<\/span>)        map.set(<span style=\"color: rgb(1, 86, 146);\">this<\/span>, value);    <span style=\"color: rgb(1, 86, 146);\">else<\/span>        createMap(t, value);    <span style=\"color: rgb(1, 86, 146);\">return<\/span> value;}<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u901a\u8fc7\u4ee5\u4e0a\u7684\u6e90\u7801\uff0c\u53ef\u4ee5\u770b\u51fa<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">T get()\u65b9\u6cd5<\/span><\/code><span style=\"font-size: 15px;\">\u7684\u6267\u884c\u6d41\u7a0b\uff0c\u5927\u81f4\u5982\u4e0b\uff1a<\/span><\/section>\n<blockquote data-sourcepos=\"742:1-745:241\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<ul data-sourcepos=\"742:3-745:241\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5148\u5c1d\u8bd5\u83b7\u5f97\u5f53\u524d\u7ebf\u7a0b\uff0c\u7136\u540e\u83b7\u5f97\u5f53\u524d\u7ebf\u7a0b\u7684ThreadLocalMap\u6210\u5458\uff0c\u6682\u5b58\u4e8emap\u53d8\u91cf\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5982\u679c\u83b7\u5f97\u7684map\u4e0d\u4e3a\u7a7a\uff0c\u4ee5\u5f53\u524dthreadlocal\u5b9e\u4f8b\u4e3aKey\u5c1d\u8bd5\u83b7\u5f97map\u4e2d\u7684Entry\uff08\u6761\u76ee\uff09\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5982\u679cEntry\u6761\u76ee\u4e0d\u4e3a\u7a7a\uff0c\u8fd4\u56deEntry\u4e2d\u7684Value\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5982\u679cEntry\u4e3a\u7a7a\uff0c\u5219\u901a\u8fc7\u8c03\u7528initialValue\u521d\u59cb\u5316\u94a9\u5b50\u51fd\u6570\u83b7\u53d6\u201cThreadLocal\u201d\u521d\u59cb\u503c\uff0c\u5e76\u8bbe\u7f6e\u5728map\u4e2d\u3002\u5982\u679cmap\u4e0d\u5b58\u5728\uff0c\u8fd8\u4f1a\u7ed9\u5f53\u524d\u7ebf\u7a0b\u521b\u5efa\u65b0ThreadLocalMap\u6210\u5458\uff0c\u5e76\u7ed1\u5b9a\u7b2c\u4e00\u4e2a\u201cKey-Value\u5bf9\u201d\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<\/blockquote>\n<h4 data-sourcepos=\"747:1-747:20\" style=\"margin: 10px auto -1px;padding-left: 3px;font-weight: bold;font-size: 18px;white-space: normal;border-left-width: 10px;border-left-style: solid;border-left-color: rgb(222, 235, 255);\"><span style=\"margin-top: -1px;padding-top: 6px;padding-right: 5px;padding-left: 5px;font-size: 16px;display: inline-block;line-height: 1.1;\">remove( )\u65b9\u6cd5<\/span><\/h4>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">remove()\u65b9\u6cd5<\/span><\/code><span style=\"font-size: 15px;\">\u7528\u4e8e\u5728\u5f53\u524d\u7ebf\u7a0b\u7684ThreadLocalMap\u4e2d\uff0c\u79fb\u9664\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u6240\u5bf9\u5e94\u7684\u503c\uff0c\u5176\u6838\u5fc3\u6e90\u7801\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"751:1-757:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\">     <section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">remove<\/span>() {         ThreadLocalMap m = getMap(Thread.currentThread());         <span style=\"color: rgb(1, 86, 146);\">if<\/span> (m != <span style=\"color: rgb(1, 86, 146);\">null<\/span>)             m.remove(<span style=\"color: rgb(1, 86, 146);\">this<\/span>);     }<\/span><\/section><\/pre>\n<h4 data-sourcepos=\"759:1-759:27\" style=\"margin: 10px auto -1px;padding-left: 3px;font-weight: bold;font-size: 18px;white-space: normal;border-left-width: 10px;border-left-style: solid;border-left-color: rgb(222, 235, 255);\"><span style=\"margin-top: -1px;padding-top: 6px;padding-right: 5px;padding-left: 5px;font-size: 16px;display: inline-block;line-height: 1.1;\">initialValue( ) \u65b9\u6cd5<\/span><\/h4>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5f53\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\u5728\u5f53\u524d\u7ebf\u7a0b\u7684<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocalMap<\/span><\/code><span style=\"font-size: 15px;\">\u4e2d\u5c1a\u672a\u7ed1\u5b9a\u503c\u65f6\uff0c<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">initialValue( )\u65b9\u6cd5<\/span><\/code><span style=\"font-size: 15px;\">\u7528\u4e8e\u83b7\u53d6\u521d\u59cb\u503c\u3002\u5176\u6e90\u7801\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"763:1-767:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\">   <section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">protected<\/span> T <span style=\"color: rgb(183, 85, 1);\">initialValue<\/span>() {        <span style=\"color: rgb(1, 86, 146);\">return<\/span> <span style=\"color: rgb(1, 86, 146);\">null<\/span>;   }<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5982\u679c\u6ca1\u6709\u8c03\u7528set\u76f4\u63a5\u8c03\u7528get\uff0c\u5219\u4f1a\u8c03\u7528\u6b64\u65b9\u6cd5\uff0c\u4f46\u662f\u8be5\u65b9\u6cd5\u53ea\u4f1a\u88ab\u8c03\u7528\u4e00\u6b21\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cinitialValue( )\u65b9\u6cd5\u8fd4\u56denull\uff0c\u5982\u679c\u4e0d\u60f3\u8fd4\u56denull\uff0c\u53ef\u4ee5\u7ee7\u627fThreadLocal\u8986\u76d6\u6b64\u65b9\u6cd5\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u771f\u7684\u9700\u8981\u7ee7\u627fThreadLocal\u53bb\u91cd\u5199initialValue()\u65b9\u6cd5\u5417\uff1f\u5176\u5b9e\u6ca1\u6709\u5fc5\u8981\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">JDK\u5df2\u7ecf\u4e3a\u5927\u5bb6\u5b9a\u4e49\u4e86\u4e00\u4e2aThreadLocal\u7684\u5185\u90e8SuppliedThreadLocal\u9759\u6001\u5b50\u7c7b\uff0c\u5e76\u4e14\u63d0\u4f9b\u4e86<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocal.withInitial(\u2026)<\/span><\/code><span style=\"font-size: 15px;\">\u9759\u6001\u5de5\u5382\u65b9\u6cd5\uff0c\u65b9\u4fbf\u5927\u5bb6\u5728\u5b9a\u4e49ThreadLocal\u5b9e\u4f8b\u65f6\u8bbe\u7f6e\u521d\u59cb\u503c\u56de\u8c03\u51fd\u6570\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4f7f\u7528\u5de5\u5382\u65b9\u6cd5\u6784\u9020ThreadLocal\u5b9e\u4f8b\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"779:1-781:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal&lt;Foo&gt; LOCAL_FOO = ThreadLocal.withInitial(() -&gt; <span style=\"color: rgb(1, 86, 146);\">new<\/span> Foo());<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">JDK\u5b9a\u4e49\u7684<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocal.withInitial(\u2026)<\/span><\/code><span style=\"font-size: 15px;\">\u9759\u6001\u5de5\u5382\u65b9\u6cd5\uff0c\u4ee5\u53ca\u5176\u5185\u90e8\u5b50\u7c7bSuppliedThreadLocal\u7684\u6e90\u7801\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"785:1-807:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\">    <section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(101, 110, 119);\">\/\/ThreadLocal\u5de5\u5382\u65b9\u6cd5\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u672c\u5730\u53d8\u91cf\u521d\u59cb\u503c\u94a9\u5b50\u51fd\u6570<\/span>    <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> &lt;S&gt; ThreadLocal&lt;S&gt; <span style=\"color: rgb(183, 85, 1);\">withInitial<\/span>(                                Supplier&lt;? extends S&gt; supplier) {        <span style=\"color: rgb(1, 86, 146);\">return<\/span> <span style=\"color: rgb(1, 86, 146);\">new<\/span> SuppliedThreadLocal&lt;&gt;(supplier);    }    <span style=\"color: rgb(101, 110, 119);\">\/\/\u5185\u90e8\u9759\u6001\u5b50\u7c7b<\/span>    <span style=\"color: rgb(101, 110, 119);\">\/\/\u7ee7\u627f\u4e86ThreadLocal\uff0c\u91cd\u5199\u4e86initialValue()\u65b9\u6cd5\uff0c\u8fd4\u56de\u94a9\u5b50\u51fd\u6570\u7684\u503c\u4f5c\u4e3a\u521d\u59cb\u503c<\/span>    <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> <span style=\"color: rgb(1, 86, 146);\">class<\/span> <span style=\"color: rgb(183, 85, 1);\">SuppliedThreadLocal<\/span>&lt;<span style=\"color: rgb(183, 85, 1);\">T<\/span>&gt; <span style=\"color: rgb(1, 86, 146);\">extends<\/span> <span style=\"color: rgb(183, 85, 1);\">ThreadLocal<\/span>&lt;<span style=\"color: rgb(183, 85, 1);\">T<\/span>&gt; {        <span style=\"color: rgb(101, 110, 119);\">\/\/\u4fdd\u5b58\u94a9\u5b50\u51fd\u6570<\/span>        <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> Supplier&lt;? extends T&gt; supplier;        <span style=\"color: rgb(101, 110, 119);\">\/\/\u4f20\u5165\u94a9\u5b50\u51fd\u6570<\/span>        SuppliedThreadLocal(Supplier&lt;? extends T&gt; supplier) {            <span style=\"color: rgb(1, 86, 146);\">this<\/span>.supplier = Objects.requireNonNull(supplier);        }        <span style=\"color: rgb(1, 86, 146);\">@Override<\/span>        <span style=\"color: rgb(1, 86, 146);\">protected<\/span> T <span style=\"color: rgb(183, 85, 1);\">initialValue<\/span>() {            <span style=\"color: rgb(1, 86, 146);\">return<\/span> supplier.get();  <span style=\"color: rgb(101, 110, 119);\">\/\/\u8fd4\u56de\u94a9\u5b50\u51fd\u6570\u7684\u503c\u4f5c\u4e3a\u521d\u59cb\u503c<\/span>        }    }<\/span><\/section><\/pre>\n<h3 data-sourcepos=\"809:1-809:30\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">ThreadLocalMap\u6e90\u7801\u5206\u6790<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u7684\u64cd\u4f5c\u90fd\u662f\u57fa\u4e8e<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocalMap<\/span><\/code><span style=\"font-size: 15px;\">\u5c55\u5f00\u7684\uff0c\u800c<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocalMap<\/span><\/code><span style=\"font-size: 15px;\">\u662fThreadLocal\u7684\u4e00\u4e2a\u9759\u6001\u5185\u90e8\u7c7b\uff0c\u5176\u5b9e\u73b0\u4e86\u4e00\u5957\u7b80\u5355\u7684Map\u7ed3\u6784\uff08\u6bd4HashMap\u7b80\u5355\uff09\u3002<\/span><\/section>\n<h4 data-sourcepos=\"813:1-813:40\" style=\"margin: 10px auto -1px;padding-left: 3px;font-weight: bold;font-size: 18px;white-space: normal;border-left-width: 10px;border-left-style: solid;border-left-color: rgb(222, 235, 255);\"><span style=\"margin-top: -1px;padding-top: 6px;padding-right: 5px;padding-left: 5px;font-size: 16px;display: inline-block;line-height: 1.1;\">ThreadLocalMap\u7684\u4e3b\u8981\u6210\u5458\u53d8\u91cf<\/span><\/h4>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocalMap<\/span><\/code><span style=\"font-size: 15px;\">\u7684\u6210\u5458\u53d8\u91cf\u4e0eHashMap\u7684\u6210\u5458\u53d8\u91cf\u975e\u5e38\u7c7b\u4f3c\uff0c\u5176\u5185\u90e8\u7684\u4e3b\u8981\u6210\u5458\u5982\u4e0b\u6240\u793a\uff1a<\/span><\/section>\n<pre data-sourcepos=\"817:1-841:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">class<\/span> <span style=\"color: rgb(183, 85, 1);\">ThreadLocal<\/span>&lt;<span style=\"color: rgb(183, 85, 1);\">T<\/span>&gt; {    ...\u7701\u7565\u5176\u4ed6                            <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">class<\/span> <span style=\"color: rgb(183, 85, 1);\">ThreadLocalMap<\/span> {            <span style=\"color: rgb(101, 110, 119);\">\/\/Map\u7684\u6761\u76ee\u6570\u7ec4\uff0c\u4f5c\u4e3a\u6563\u5217\u8868\u4f7f\u7528<\/span>        <span style=\"color: rgb(1, 86, 146);\">private<\/span> Entry[] table;          <span style=\"color: rgb(101, 110, 119);\">\/\/Map\u7684\u6761\u76ee\u521d\u59cb\u5bb9\u91cf16<\/span>         <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> <span style=\"color: rgb(1, 86, 146);\">int<\/span> INITIAL_CAPACITY = <span style=\"color: rgb(183, 85, 1);\">16<\/span>;        <span style=\"color: rgb(101, 110, 119);\">\/\/Map\u7684\u6761\u76ee\u6570\u91cf <\/span>        <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">int<\/span> size = <span style=\"color: rgb(183, 85, 1);\">0<\/span>;       <span style=\"color: rgb(101, 110, 119);\">\/\/\u6269\u5bb9\u56e0\u5b50<\/span>        <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">int<\/span> threshold;         <span style=\"color: rgb(101, 110, 119);\">\/\/Map\u7684\u6761\u76ee\u7c7b\u578b\uff0c\u4e00\u4e2a\u9759\u6001\u7684\u5185\u90e8\u7c7b<\/span>       <span style=\"color: rgb(101, 110, 119);\">\/\/ Entry \u7ee7\u627f\u5b50WeakReference,Key\u4e3aThreadLocal\u5b9e\u4f8b<\/span>       <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">class<\/span> <span style=\"color: rgb(183, 85, 1);\">Entry<\/span> <span style=\"color: rgb(1, 86, 146);\">extends<\/span> <span style=\"color: rgb(183, 85, 1);\">WeakReference<\/span>&lt;<span style=\"color: rgb(183, 85, 1);\">ThreadLocal<\/span>&lt;?&gt;&gt; {            Object value; <span style=\"color: rgb(101, 110, 119);\">\/\/\u6761\u76ee\u7684\u503c<\/span>            Entry(ThreadLocal&lt;?&gt; k, Object v) {                <span style=\"color: rgb(1, 86, 146);\">super<\/span>(k);                value = v;            }        }    ...\u7701\u7565\u5176\u4ed6        } <\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u6e90\u7801\u4e2d<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">get\uff08\uff09<\/span><\/code><span style=\"font-size: 15px;\">\u3001<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">set\uff08 \uff09<\/span><\/code><span style=\"font-size: 15px;\">\u3001<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">remove\uff08\uff09\u65b9\u6cd5<\/span><\/code><span style=\"font-size: 15px;\">\u90fd\u6d89\u53ca\u5230ThreadLocalMap\u7684\u65b9\u6cd5\u8c03\u7528\uff0c\u4e3b\u8981\u8c03\u7528\u4e86ThreadLocalMap\u7684\u5982\u4e0b\u51e0\u4e2a\u51fd\u6570\uff1a<\/span><\/section>\n<blockquote data-sourcepos=\"845:1-847:93\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<ul data-sourcepos=\"845:3-847:93\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">set(ThreadLocal&lt;?&gt; key, Object value) \uff1a\u5411Map\u5b9e\u4f8b\u8bbe\u7f6e\u201cKey-Value\u5bf9\u201d\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">getEntry(ThreadLocal)\uff1a\u4eceMap\u5b9e\u4f8b\u83b7\u53d6Key\uff08ThreadLocal\u5b9e\u4f8b\uff09\u6240\u5c5e\u7684Entry\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">remove(ThreadLocal)\uff1a\u6839\u636eKey\uff08ThreadLocal\u5b9e\u4f8b\uff09\u4eceMap\u5b9e\u4f8b\u79fb\u9664\u6240\u5c5e\u7684Entry\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<\/blockquote>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4f5c\u4e3a\u53c2\u8003\uff0c\u8fd9\u91cc\u53ea\u5c06<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocalMap<\/span><\/code><span style=\"font-size: 15px;\">\u7684<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">set(ThreadLocal&lt;?&gt; key, Object value) \u65b9\u6cd5<\/span><\/code><span style=\"font-size: 15px;\">\u7684\u4ee3\u7801\u4ee5\u6ce8\u91ca\u7684\u5f62\u5f0f\u505a\u4e00\u4e2a\u7b80\u5355\u7684\u5206\u6790\uff0c\u5177\u4f53\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"851:1-885:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\">        <section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">set<\/span>(ThreadLocal&lt;?&gt; key, Object value) {            Entry[] tab = table;            <span style=\"color: rgb(1, 86, 146);\">int<\/span> len = tab.length;             <span style=\"color: rgb(101, 110, 119);\">\/\/\u6839\u636ekey\u7684HashCode\uff0c\u627e\u5230key\u5728\u6570\u7ec4\u4e0a\u7684\u69fd\u70b9i<\/span>             <span style=\"color: rgb(1, 86, 146);\">int<\/span> i = key.threadLocalHashCode &amp; (len-<span style=\"color: rgb(183, 85, 1);\">1<\/span>);            <span style=\"color: rgb(101, 110, 119);\">\/\/ \u4ece\u69fd\u70b9i\u5f00\u59cb\u5411\u540e\u5faa\u73af\u641c\u7d22\uff0c\u627e\u7a7a\u4f59\u69fd\u70b9\uff08\u7a7a\u4f59\u4f4d\u7f6e\uff09\u6216\u8005\u627e\u73b0\u6709\u69fd\u70b9<\/span>            <span style=\"color: rgb(101, 110, 119);\">\/\/\u5982\u679c\u6ca1\u6709\u73b0\u6709\u69fd\u70b9\uff0c\u5219\u5fc5\u5b9a\u6709\u7a7a\u4f59\u69fd\u70b9\uff0c\u56e0\u4e3a\u6ca1\u6709\u7a7a\u95f4\u65f6\u4f1a\u6269\u5bb9 <\/span>            <span style=\"color: rgb(1, 86, 146);\">for<\/span> (Entry e = tab[i];   e != <span style=\"color: rgb(1, 86, 146);\">null<\/span>;                                      e = tab[i = nextIndex(i, len)]) {                ThreadLocal&lt;?&gt; k = e.get();                <span style=\"color: rgb(101, 110, 119);\">\/\/\u627e\u5230\u73b0\u6709\u69fd\u70b9\uff1aKey\u503c\u4e3aThreadLocal\u5b9e\u4f8b<\/span>                <span style=\"color: rgb(1, 86, 146);\">if<\/span> (k == key) {                    e.value = value;                    <span style=\"color: rgb(1, 86, 146);\">return<\/span>;                }                <span style=\"color: rgb(101, 110, 119);\">\/\/\u627e\u5230\u5f02\u5e38\u69fd\u70b9\uff1a\u69fd\u70b9\u88abGC\u6389\uff0c\u91cd\u8bbeKey\u503c\u548cValue\u503c <\/span>                <span style=\"color: rgb(1, 86, 146);\">if<\/span> (k == <span style=\"color: rgb(1, 86, 146);\">null<\/span>) {                    replaceStaleEntry(key, value, i);                    <span style=\"color: rgb(1, 86, 146);\">return<\/span>;                }            }            <span style=\"color: rgb(101, 110, 119);\">\/\/\u6ca1\u6709\u627e\u5230\u73b0\u6709\u7684\u69fd\u70b9\uff0c\u589e\u52a0\u65b0\u7684Entry<\/span>            tab[i] = <span style=\"color: rgb(1, 86, 146);\">new<\/span> Entry(key, value);            <span style=\"color: rgb(101, 110, 119);\">\/\/\u8bbe\u7f6eThreadLocal\u6570\u91cf<\/span>            <span style=\"color: rgb(1, 86, 146);\">int<\/span> sz = ++size;            <span style=\"color: rgb(101, 110, 119);\">\/\/\u6e05\u7406Key\u4e3anull\u7684\u65e0\u6548Entry<\/span>            <span style=\"color: rgb(101, 110, 119);\">\/\/\u6ca1\u6709\u53ef\u6e05\u7406\u7684Entry\uff0c\u5e76\u4e14\u73b0\u6709\u6761\u76ee\u6570\u91cf\u5927\u4e8e\u6269\u5bb9\u56e0\u5b50\u503c\uff0c\u8fdb\u884c\u6269\u5bb9<\/span>            <span style=\"color: rgb(1, 86, 146);\">if<\/span> (!cleanSomeSlots(i, sz) &amp;&amp; sz &gt;= threshold)                rehash();        }<\/span><\/section><\/pre>\n<h4 data-sourcepos=\"887:1-887:37\" style=\"margin: 10px auto -1px;padding-left: 3px;font-weight: bold;font-size: 18px;white-space: normal;border-left-width: 10px;border-left-style: solid;border-left-color: rgb(222, 235, 255);\"><span style=\"margin-top: -1px;padding-top: 6px;padding-right: 5px;padding-left: 5px;font-size: 16px;display: inline-block;line-height: 1.1;\">Entry\u7684Key\u9700\u8981\u4f7f\u7528\u5f31\u5f15\u7528<\/span><\/h4>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">Entry<\/span><\/code><span style=\"font-size: 15px;\">\u7528\u4e8e\u4fdd\u5b58ThreadLocalMap\u7684\u201c<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">Key-Value<\/span><\/code><span style=\"font-size: 15px;\">\u201d\u6761\u76ee\uff0c\u4f46\u662fEntry\u4f7f\u7528\u4e86\u5bf9Threadlocal\u5b9e\u4f8b\u8fdb\u884c\u5305\u88c5\u4e4b\u540e\u7684\u5f31\u5f15\u7528\uff08<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">WeakReference<\/span><\/code><span style=\"font-size: 15px;\">\uff09\u4f5c\u4e3aKey\uff0c\u5176\u4ee3\u7801\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"891:1-900:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(101, 110, 119);\">\/\/ Entry \u7ee7\u627f\u4e86WeakReference,\u5e76\u4f7f\u7528WeakReference\u5bf9Key\u8fdb\u884c\u5305\u88c5<\/span><span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">class<\/span> <span style=\"color: rgb(183, 85, 1);\">Entry<\/span> <span style=\"color: rgb(1, 86, 146);\">extends<\/span> <span style=\"color: rgb(183, 85, 1);\">WeakReference<\/span>&lt;<span style=\"color: rgb(183, 85, 1);\">ThreadLocal<\/span>&lt;?&gt;&gt; {    Object value; <span style=\"color: rgb(101, 110, 119);\">\/\/\u503c<\/span>    Entry(ThreadLocal&lt;?&gt; k, Object v) {        <span style=\"color: rgb(1, 86, 146);\">super<\/span>(k);  <span style=\"color: rgb(101, 110, 119);\">\/\/\u4f7f\u7528WeakReference\u5bf9Key\u503c\u8fdb\u884c\u5305\u88c5<\/span>        value = v;    }}<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e3a\u4ec0\u4e48Entry\u9700\u8981\u4f7f\u7528\u5f31\u5f15\u7528\u5bf9Key\u8fdb\u884c\u5305\u88c5\uff0c\u800c\u4e0d\u662f\u76f4\u63a5\u4f7f\u7528Threadlocal\u5b9e\u4f8b\u4f5c\u4e3aKey\u5462\uff1f<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u4e2a\u95ee\u9898\u6709\u70b9\u513f\u590d\u6742\uff0c\u5982\u679c\u8981\u5206\u6790\u6e05\u695a\u8fd8\u6709\u70b9\u96be\u5ea6\u3002\u8fd9\u91cc\u4ece\u4e00\u4e2a\u7b80\u5355\u7684\u4f8b\u5b50\u5165\u624b\uff0c\u5047\u8bbe\u6709\u4e00\u4e2a\u65b9\u6cd5funcA( )\u521b\u5efa\u4e86\u4e00\u4e2a\u201c\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf\u201d\uff0c\u5177\u4f53\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"906:1-917:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\">    <section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">funcA<\/span>()    {        <span style=\"color: rgb(101, 110, 119);\">\/\/\u521b\u5efa\u4e00\u4e2a\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf<\/span>        ThreadLocal local = <span style=\"color: rgb(1, 86, 146);\">new<\/span> ThreadLocal&lt;Integer&gt;();         <span style=\"color: rgb(101, 110, 119);\">\/\/\u8bbe\u7f6e\u503c<\/span>        local.set(<span style=\"color: rgb(183, 85, 1);\">100<\/span>);           <span style=\"color: rgb(101, 110, 119);\">\/\/\u83b7\u53d6\u503c<\/span>        local.get();          <span style=\"color: rgb(101, 110, 119);\">\/\/\u51fd\u6570\u672b\u5c3e<\/span>    }<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5f53\u7ebf\u7a0btn\u6267\u884cfuncA\u65b9\u6cd5\u5230\u5176\u672b\u5c3e\u65f6\uff0c\u7ebf\u7a0btn\u76f8\u5173\u7684JVM\u6808\u5185\u5b58\u4ee5\u53ca\u5185\u90e8ThreadLocalMap\u6210\u5458\u7684\u7ed3\u6784\uff0c\u5927\u81f4\u5982\u56fe1-20\u6240\u793a\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7ebf\u7a0btn\u8c03\u7528funcA\uff08\uff09\u65b9\u6cd5\u65b0\u5efa\u4e86\u4e00\u4e2aThreadLocal\u5b9e\u4f8b\uff0c\u5e76\u4f7f\u7528local \u5c40\u90e8\u53d8\u91cf\u6307\u5411\u8fd9\u4e2a\u5b9e\u4f8b\uff0c\u5e76\u4e14\u6b64local \u662f\u5f3a\u5f15\u7528\uff1b<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728\u8c03\u7528<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">local.set\uff08100\uff09<\/span><\/code><span style=\"font-size: 15px;\">\u4e4b\u540e\uff0c\u7ebf\u7a0btn\u7684ThreadLocalMap\u6210\u5458\u5185\u90e8\u4f1a\u65b0\u5efa\u4e00\u4e2aEntry\u5b9e\u4f8b\uff0c\u5176Key \u4ee5\u5f31\u5f15\u7528\u5305\u88c5\u7684\u65b9\u5f0f\u6307\u5411ThreadLocal\u5b9e\u4f8b\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5f53\u7ebf\u7a0btn\u6267\u884c\u5b8cfuncA\u65b9\u6cd5\u540e\uff0cfuncA\u7684\u65b9\u6cd5\u6808\u5e27\u5c06\u88ab\u9500\u6bc1\uff0c\u5f3a\u5f15\u7528 local \u7684\u503c\u4e5f\u5c31\u6ca1\u6709\u4e86\uff0c\u4f46\u6b64\u65f6\u7ebf\u7a0b\u7684ThreadLocalMap\u91cc\u7684\u5bf9\u5e94\u7684Entry\u7684 Key \u5f15\u7528\u8fd8\u6307\u5411\u4e86<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocal<\/span><\/code><span style=\"font-size: 15px;\">\u5b9e\u4f8b\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u82e5Entry\u7684 Key \u5f15\u7528\u662f<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u5f3a\u5f15\u7528<\/span><\/code><span style=\"font-size: 15px;\">\uff0c<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u5c31\u4f1a\u5bfc\u81f4Key\u5f15\u7528\u6307\u5411\u7684ThreadLocal\u5b9e\u4f8b\u3001\u53ca\u5176Value\u503c\u90fd\u4e0d\u80fd\u88abGC\u56de\u6536<\/span><\/code><span style=\"font-size: 15px;\">\uff0c\u8fd9\u5c06\u9020\u6210\u4e25\u91cd\u7684<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u5185\u5b58\u6cc4\u9732<\/span><\/code><span style=\"font-size: 15px;\">\uff0c\u5177\u4f53\u5982\u56fe1-21\u6240\u793a\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\">\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018213\" data-ratio=\"0.6736353077816493\" data-s=\"300,640\"  data-type=\"png\" data-w=\"861\" style=\"\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142844199.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018213\" data-ratio=\"0.6736353077816493\" data-s=\"300,640\"  data-type=\"png\" data-w=\"861\" style=\"\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142844199.png\"  \/><\/noscript><\/p>\n<\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"> \u56fe1-20 \u5f53\u7ebf\u7a0btn\u6267\u884cfuncA\u65b9\u6cd5\u672b\u5c3e\u65f6\u5185\u5b58\u7ed3\u6784<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018214\" data-ratio=\"0.663981588032221\" data-s=\"300,640\"  data-type=\"png\" data-w=\"869\" style=\"\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142847520.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018214\" data-ratio=\"0.663981588032221\" data-s=\"300,640\"  data-type=\"png\" data-w=\"869\" style=\"\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142847520.png\"  \/><\/noscript><\/p>\n<p>            \u56fe1-21 \u82e5Entry\u7684Key\u4e3a\u5f3a\u5f15\u7528\u5c06\u5bfc\u81f4ThreadLocal\u5b9e\u4f8b\u4e0d\u80fd\u56de\u6536<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u4ec0\u4e48\u662f\u5f31\u5f15\u7528\u5462\uff1f<\/strong><\/span><\/section>\n<blockquote data-sourcepos=\"939:1-941:172\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4ec5\u6709\u5f31\u5f15\u7528\uff08WeakReference\uff09\u6307\u5411\u7684\u5bf9\u8c61\uff0c\u53ea\u80fd\u751f\u5b58\u5230\u4e0b\u4e00\u6b21\u5783\u573e\u56de\u6536\u4e4b\u524d\u3002<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6362\u53e5\u8bdd\u8bf4\uff0c\u5f53GC\u53d1\u751f\u65f6\uff0c\u4e0d\u7ba1\u5185\u5b58\u591f\u4e0d\u591f\uff0c\u4ec5\u6709\u5f31\u5f15\u7528\u6240\u6307\u5411\u7684\u5bf9\u8c61\u90fd\u4f1a\u88ab\u56de\u6536\u3002\u800c\u62e5\u6709\u5f3a\u5f15\u7528\u6307\u5411\u7684\u5bf9\u8c61\uff0c\u5219\u4e0d\u4f1a\u88ab\u76f4\u63a5\u56de\u6536\u3002<\/span><\/section>\n<\/blockquote>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u4ec0\u4e48\u662f\u5185\u5b58\u6cc4\u6f0f\u5462\uff1f<\/strong><\/span><\/section>\n<blockquote data-sourcepos=\"945:1-947:155\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e0d\u518d\u7528\u5230\u7684\u5185\u5b58\uff0c\u6ca1\u6709\u53ca\u65f6\u91ca\u653e\uff0c\u5c31\u53eb\u505a\u5185\u5b58\u6cc4\u6f0f\u3002<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5bf9\u4e8e\u6301\u7eed\u8fd0\u884c\u7684\u670d\u52a1\u8fdb\u7a0b\uff0c\u5fc5\u987b\u53ca\u65f6\u91ca\u653e\u5185\u5b58\uff0c\u5426\u5219\u5185\u5b58\u5360\u7528\u7387\u8d8a\u6765\u8d8a\u9ad8\uff0c\u8f7b\u5219\u5f71\u54cd\u7cfb\u7edf\u6027\u80fd\uff0c\u91cd\u5219\u5bfc\u81f4\u8fdb\u7a0b\u5d29\u6e83\u3002<\/span><\/section>\n<\/blockquote>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7531\u4e8eThreadLocalMap\u4e2dEntry\u7684 Key \u4f7f\u7528\u4e86\u5f31\u5f15\u7528\uff0c\u5728\u4e0b\u6b21GC\u53d1\u751f\u65f6\uff0c\u5c31\u53ef\u4ee5\u4f7f\u90a3\u4e9b\u6ca1\u6709\u88ab\u5176\u4ed6\u5f3a\u5f15\u7528\u6307\u5411\u3001\u4ec5\u88abEntry\u7684Key \u6240\u6307\u5411\u7684ThreadLocal\u5b9e\u4f8b\u80fd\u88ab\u987a\u5229\u56de\u6536\u3002\u5e76\u4e14\uff0c\u5728Entry\u7684Key\u5f15\u7528\u88ab\u56de\u6536\u4e4b\u540e\uff0c\u5176Entry\u7684Key\u503c\u53d8\u4e3anull\u3002\u540e\u7eed\u5f53ThreadLocal\u7684<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">get<\/span><\/code><span style=\"font-size: 15px;\">\u3001<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">set<\/span><\/code><span style=\"font-size: 15px;\">\u6216<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">remove<\/span><\/code><span style=\"font-size: 15px;\">\u88ab\u8c03\u7528\u65f6\uff0cThreadLocalMap\u7684\u5185\u90e8\u4ee3\u7801\u4f1a\u6e05\u9664\u8fd9\u4e9bKey\u4e3anull\u7684Entry\uff0c\u4ece\u800c\u5b8c\u6210\u76f8\u5e94\u7684\u5185\u5b58\u91ca\u653e\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u603b\u7ed3\u4e00\u4e0b\uff0c\u4f7f\u7528ThreadLocal\u4f1a\u53d1\u751f<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u5185\u5b58\u6cc4\u6f0f<\/span><\/code><span style=\"font-size: 15px;\">\u7684\u524d\u63d0\u6761\u4ef6\uff1a<\/span><\/section>\n<blockquote data-sourcepos=\"953:1-954:156\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<ul data-sourcepos=\"953:3-954:156\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7ebf\u7a0b\u957f\u65f6\u95f4\u8fd0\u884c\u800c\u6ca1\u6709\u88ab\u9500\u6bc1\u3002<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u7ebf\u7a0b\u6c60<\/span><\/code><span style=\"font-size: 15px;\">\u4e2d\u7684Thread\u5b9e\u4f8b\u5f88\u5bb9\u6613\u6ee1\u8db3\u6b64\u6761\u4ef6\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u5f15\u7528\u88ab\u8bbe\u7f6e\u4e3anull\uff0c\u4e14\u540e\u7eed\u5728\u540c\u4e00Thread\u5b9e\u4f8b\u7684\u6267\u884c\u671f\u95f4\uff0c\u6ca1\u6709\u53d1\u751f\u5bf9\u5176\u4ed6ThreadLocal\u5b9e\u4f8b\u7684get\u3001set\u6216remove\u64cd\u4f5c\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<\/blockquote>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u53ea\u8981\u5b58\u5728\u4e00\u4e2a\u9488\u5bf9\u4efb\u4f55ThreadLocal\u5b9e\u4f8b\u7684get\u3001set\u6216remove\u64cd\u4f5c\uff0c\u5c31\u4f1a\u89e6\u53d1Thread\u5b9e\u4f8b\u62e5\u6709\u7684ThreadLocalMap\u7684Key\u4e3anull\u7684Entry\u6e05\u7406\u5de5\u4f5c\uff0c\u91ca\u653e\u6389ThreadLocal\u5f31\u5f15\u7528\u4e3anull\u7684Entry\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7efc\u5408\u4ee5\u4e0a\u4e24\u6761\u53ef\u4ee5\u770b\u51fa\uff1a\u4f7f\u7528ThreadLocal\u51fa\u73b0\u5185\u5b58\u6cc4\u6f0f\u8fd8\u662f\u6bd4\u8f83\u5bb9\u6613\u7684\u3002\u4f46\u662f\u4e00\u822c\u516c\u53f8\u5bf9\u5982\u4f55\u4f7f\u7528ThreadLocal\u90fd\u6709\u7f16\u7a0b\u89c4\u8303\u8981\u6c42\uff0c\u53ea\u8981\u5927\u5bb6\u6309\u7167\u89c4\u8303\u7f16\u5199\u7a0b\u5e8f\uff0c\u4e5f\u6ca1\u6709\u90a3\u4e48\u5bb9\u6613\u53d1\u751f\u5185\u5b58\u6cc4\u6f0f\u3002<\/span><\/section>\n<h2 data-sourcepos=\"962:1-962:41\" style=\"font-weight: bold;font-size: 22px;margin: 10px auto 5px;border-top-width: 1px;border-top-style: solid;border-top-color: rgb(242, 242, 242);background-color: rgb(242, 242, 242);\"><span style=\"margin-top: -1px;padding-top: 14px;padding-bottom: 14px;padding-right: 5px;padding-left: 5px;font-size: 17px;border-top: 4px solid rgb(33, 33, 34);display: inline-block;line-height: 1.5;font-weight: normal;background-color: rgb(30, 30, 30);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 20px;padding-left: 10px;\">\u9762\u8bd5\u96be\u70b9\uff1aThreadLocal\u9020\u6210\u5185\u5b58\u6cc4\u9732\u7684\u95ee\u9898<\/span><\/h2>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u4ec0\u4e48\u662f\u5185\u5b58\u6cc4\u6f0f\uff1f<\/strong><\/span><\/section>\n<blockquote data-sourcepos=\"966:1-968:155\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e0d\u518d\u7528\u5230\u7684\u5185\u5b58\uff0c\u6ca1\u6709\u53ca\u65f6\u91ca\u653e\uff0c\u5c31\u53eb\u505a\u5185\u5b58\u6cc4\u6f0f\u3002<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5bf9\u4e8e\u6301\u7eed\u8fd0\u884c\u7684\u670d\u52a1\u8fdb\u7a0b\uff0c\u5fc5\u987b\u53ca\u65f6\u91ca\u653e\u5185\u5b58\uff0c\u5426\u5219\u5185\u5b58\u5360\u7528\u7387\u8d8a\u6765\u8d8a\u9ad8\uff0c\u8f7b\u5219\u5f71\u54cd\u7cfb\u7edf\u6027\u80fd\uff0c\u91cd\u5219\u5bfc\u81f4\u8fdb\u7a0b\u5d29\u6e83\u3002<\/span><\/section>\n<\/blockquote>\n<h3 data-sourcepos=\"972:1-972:51\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">ThreadLocal\u662f\u600e\u4e48\u9020\u6210\u5185\u5b58\u6cc4\u9732\u7684\u5462\uff1f<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5982\u679c\u53d1\u751f\u4e86\u4e0b\u9762\u7684\u60c5\u51b5\uff1a<\/span><\/section>\n<ul data-sourcepos=\"976:1-979:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5982\u679cThreadLocal\u662fnull\u4e86\uff0c\u4e5f\u5c31\u662f\u8981\u88abGC\u56de\u6536\u4e86\uff0c<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4f46\u662f\u6b64\u65f6\u6211\u4eec\u7684ThreadLocalMap\uff08thread \u7684\u5185\u90e8\u5c5e\u6027\uff09\u751f\u547d\u5468\u671f\u548cThread\u7684\u4e00\u6837\uff0c\u5b83\u4e0d\u4f1a\u56de\u6536\uff0c\u8fd9\u65f6\u5019\u5c31\u51fa\u73b0\u4e86\u4e00\u4e2a\u73b0\u8c61\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u603b\u4e4b\uff0c\u5c31\u662fThreadLocalMap\u7684key\u6ca1\u4e86\uff0c\u4f46\u662fvalue\u8fd8\u5728\uff0c\u8fd9\u5c31\u9020\u6210\u4e86\u5185\u5b58\u6cc4\u6f0f\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6211\u4eec\u7ec6\u81f4\u7684\u5206\u6790\u4e00\u4e0b\u3002<\/span><\/section>\n<h3 data-sourcepos=\"984:1-984:34\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">ThreadLocal \u6709\u4e24\u4e2a\u5f15\u7528\u94fe<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocalMap\u4e2d\u7684Key\u5c31\u662fThreadLocal\u5bf9\u8c61\uff0cThreadLocal \u6709\u4e24\u4e2a\u5f15\u7528\u94fe\uff1a<\/span><\/section>\n<ul data-sourcepos=\"988:1-992:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u4e00\u4e2a\u5f15\u7528\u94fe\u662f\u6808\u5185\u5b58\u4e2dThreadLocal\u5f15\u7528<\/strong>\uff1a<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u4e00\u4e2a\u5f15\u7528\u94fe\u662fThreadLocalMap\u4e2d\u7684Key\u5bf9\u5b83\u7684\u5f15\u7528<\/strong>\uff1a<\/span><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018215\" data-ratio=\"0.549074074074074\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;font-size: 16px;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142849347.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018215\" data-ratio=\"0.549074074074074\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;font-size: 16px;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142849347.png\"  \/><\/noscript><\/section>\n<\/li>\n<\/ul>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u800c\u5bf9\u4e8eValue\uff08\u5b9e\u9645\u4fdd\u5b58\u7684\u503c\uff09\u6765\u8bf4\uff0c\u5b83\u7684\u5f15\u7528\u94fe\u53ea\u6709\u4e00\u6761\uff0c\u5c31\u662f\u4eceThread\u5bf9\u8c61\u5f15\u7528\u8fc7\u6765\u7684\uff0c\u5982\u4e0b\u56fe\uff1a<\/span><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018216\" data-ratio=\"0.5120370370370371\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142853205.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018216\" data-ratio=\"0.5120370370370371\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142853205.png\"  \/><\/noscript><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e0a\u8ff0\u8fc7\u7a0b\u5206\u6790\u540e\uff0c\u5c31\u4f1a\u51fa\u73b0\u5982\u4e0b\u7684\u4e24\u79cd\u60c5\u51b5\uff1a<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u60c5\u51b51\uff1a key\u7684\u6cc4\u6f0f<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u60c5\u51b52\uff1a value\u7684\u6cc4\u6f0f<\/span><\/section>\n<h3 data-sourcepos=\"1011:1-1011:26\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">\u60c5\u51b51\uff1akey\u7684\u6cc4\u6f0f<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6808\u4e0a\u7684ThreadLocal Ref\u5f15\u7528\u4e0d\u518d\u4f7f\u7528\u4e86\uff0c\u5373\u5f53\u524d\u65b9\u6cd5\u7ed3\u675f\u5904\u7406\u540e\uff0c\u8fd9\u4e2a\u5bf9\u8c61\u5f15\u7528\u5c31\u4e0d\u518d\u4f7f\u7528\u4e86\uff0c<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u90a3\u4e48\uff0cThreadLocal\u5bf9\u8c61\u56e0\u4e3a\u8fd8\u6709\u4e00\u6761\u5f15\u7528\u94fe\u5b58\u5728\uff0c\u5982\u679c\u662f\u5f3a\u5f15\u7528\u7684\u8bdd\uff0c\u8fd9\u91cc\u5c31\u4f1a\u5bfc\u81f4ThreadLocal\u5bf9\u8c61\u65e0\u6cd5\u88ab\u56de\u6536\uff0c\u53ef\u80fd\u5bfc\u81f4OOM\u3002<\/span><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018217\" data-ratio=\"0.5472222222222223\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142858890.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018217\" data-ratio=\"0.5472222222222223\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142858890.png\"  \/><\/noscript><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u60c5\u51b51 \u7684\u89e3\u51b3\u65b9\u6848\uff0c\u4f7f\u7528\u5f31\u5f15\u7528\u89e3\u51b3 \u3002<\/span><\/section>\n<h3 data-sourcepos=\"1021:1-1021:29\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">\u60c5\u51b52\uff1a value\u7684\u6cc4\u6f0f<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u60c5\u51b52.\u5047\u8bbe\u6211\u4eec\u4f7f\u7528\u4e86\u7ebf\u7a0b\u6c60\uff0c\u5982\u679cThread\u5bf9\u8c61\u4e00\u76f4\u88ab\u5360\u7528\u4f7f\u7528\u4e2d\uff08<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u5982\u5728\u7ebf\u7a0b\u6c60\u4e2d\u88ab\u91cd\u590d\u4f7f\u7528<\/span><\/code><span style=\"font-size: 15px;\">\uff09\uff0c\u4f46\u662f\u6b64\u65f6\u6211\u4eec\u7684ThreadLocalMap\uff08thread \u7684\u5185\u90e8\u5c5e\u6027\uff09\u751f\u547d\u5468\u671f\u548cThread\u7684\u4e00\u6837\uff0c\u5b83\u4e0d\u4f1a\u56de\u6536\uff0c\u8fd9\u65f6\u5019\u5c31\u51fa\u73b0\u4e86\u4e00\u4e2a\u73b0\u8c61\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u5c31\u610f\u5473\u7740\uff0cValue\u8fd9\u6761\u5f15\u7528\u94fe\u5c31\u4e00\u76f4\u5b58\u5728\uff0c\u90a3\u4e48\u5c31\u4f1a\u5bfc\u81f4ThreadLocalMap\u65e0\u6cd5\u88abJVM\u56de\u6536\uff0c\u53ef\u80fd\u5bfc\u81f4OOM\uff0c\u5982\u4e0a\u56fe\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u60c5\u51b52 \uff0c\u6bd4\u8f83\u4e25\u91cd\u3002\u8fd8\u5f97\u53e6\u60f3\u529e\u6cd5\u3002<\/span><\/section>\n<h3 data-sourcepos=\"1031:1-1031:71\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">\u60c5\u51b51\u7684\u89e3\u51b3\u65b9\u6848\uff1a\u4f7f\u7528\u5f31\u5f15\u7528\uff0c\u89e3\u51b3key\u7684\u5185\u5b58\u6cc4\u9732<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4ece\u5982\u4e0bThreadLocal\u4e2d\u5185\u90e8\u7c7bEntry\u4ee3\u7801\u53ef\u77e5\uff1a<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">Entry\u7c7b\u7684\u7236\u7c7b\u662f\u5f31\u5f15\u7528WeakReference\uff0cThreadLocal\u7684\u5f15\u7528k\u901a\u8fc7 WeakReference \u6784\u9020\u65b9\u6cd5\u4f20\u9012\u7ed9\u4e86 \u7236\u7c7bWeakReference\u7684\u6784\u9020\u65b9\u6cd5\uff0c<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4ece\u800c\uff0cThreadLocalMap\u4e2d\u7684Key\u662fThreadLocal\u7684\u5f31\u5f15\u7528\uff0c\u901a\u8fc7\u5f31\u5f15\u7528\u6765\u89e3\u51b3\u5185\u5b58\u6cc4\u9732\u95ee\u9898\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5177\u4f53\u7684\u4ee3\u7801\u5982\u4e0b<\/span><\/section>\n<pre data-sourcepos=\"1041:1-1051:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">class<\/span> <span style=\"color: rgb(183, 85, 1);\">ThreadLocalMap<\/span> {        <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">class<\/span> <span style=\"color: rgb(183, 85, 1);\">Entry<\/span> <span style=\"color: rgb(1, 86, 146);\">extends<\/span> <span style=\"color: rgb(183, 85, 1);\">WeakReference<\/span>&lt;<span style=\"color: rgb(183, 85, 1);\">ThreadLocal<\/span>&lt;?&gt;&gt; {            Object value;            Entry(ThreadLocal&lt;?&gt; k, Object v) {                <span style=\"color: rgb(1, 86, 146);\">super<\/span>(k); <span style=\"color: rgb(101, 110, 119);\">\/\/ key\u4e3a\u5f31\u5f15\u7528<\/span>                value = v;            }        }}<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6808\u5185\u5b58\u4e2d\u7684ThreadLocal Ref\u5f15\u7528\u4e0d\u518d\u4f7f\u7528\u4e86\uff0c\u5373\u5f53\u5f53\u524d\u65b9\u6cd5\u7ed3\u675f\u5904\u7406\u540e\uff0c\u8fd9\u4e2akey\u5bf9\u8c61\u5f15\u7528\u5c31\u4e0d\u518d\u4f7f\u7528\u4e86\uff0c<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u90a3\u4e48\uff0c\u5982\u679c\u8fd9\u91cc \u4e0d\u7528\u5f31\u5f15\u7528\u800c\u662f\u5f3a\u5f15\u7528\u7684\u8bdd\uff0c\u8fd9\u91ccThreadLocal\u5bf9\u8c61\u56e0\u4e3a\u8fd8\u6709\u4e00\u6761\u5f15\u7528\u94fe\u5b58\u5728\uff0c\u6240\u4ee5\u5c31\u4f1a\u5bfc\u81f4\u4ed6\u65e0\u6cd5\u88ab\u56de\u6536\uff0c\u53ef\u80fd\u5bfc\u81f4OOM\u3002<\/span><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018218\" data-ratio=\"0.5472222222222223\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142902191.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018218\" data-ratio=\"0.5472222222222223\" data-s=\"300,640\"  data-type=\"png\" data-w=\"1080\" style=\"text-align: center;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142902191.png\"  \/><\/noscript><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u56de\u987eJava\u4e2d4\u79cd\u5f15\u7528\u7c7b\u578b<\/span><\/section>\n<blockquote data-sourcepos=\"1065:1-1080:81\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<ol data-sourcepos=\"1065:3-1080:81\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u5f3a\u5f15\u7528\uff08Strong Reference\uff09<\/strong>\uff1a<\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"1066:6-1067:104\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u662f\u6700\u5e38\u89c1\u7684\u5f15\u7528\u7c7b\u578b\u3002\u4e00\u4e2a\u5bf9\u8c61\u5177\u6709\u5f3a\u5f15\u7528\uff0c\u5783\u573e\u6536\u96c6\u5668\u5c31\u4e0d\u4f1a\u56de\u6536\u5b83\uff0c\u5373\u4f7f\u7cfb\u7edf\u5185\u5b58\u7a7a\u95f4\u4e0d\u8db3\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u793a\u4f8b\uff1a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">Object obj = new Object();<\/span><\/code><span style=\"font-size: 15px;\">\u5728\u8fd9\u91cc\uff0c<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">obj<\/span><\/code><span style=\"font-size: 15px;\">\u5c31\u662f<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">new Object()<\/span><\/code><span style=\"font-size: 15px;\">\u7684\u4e00\u4e2a\u5f3a\u5f15\u7528\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u8f6f\u5f15\u7528\uff08Soft Reference\uff09<\/strong>\uff1a<\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"1069:6-1071:78\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7528\u6765\u63cf\u8ff0\u4e00\u4e9b\u53ef\u80fd\u8fd8\u6709\u7528\u4f46\u5e76\u975e\u5fc5\u9700\u7684\u5bf9\u8c61\u3002\u5728\u7cfb\u7edf\u5c06\u8981\u53d1\u751f\u5185\u5b58\u6ea2\u51fa\u5f02\u5e38\u524d\uff0c\u5c06\u4f1a\u628a\u8fd9\u4e9b\u5bf9\u8c61\u5217\u8fdb\u56de\u6536\u8303\u56f4\u4e4b\u4e2d\u8fdb\u884c\u7b2c\u4e8c\u6b21\u56de\u6536\u3002\u5982\u679c\u8fd9\u6b21\u56de\u6536\u8fd8\u6ca1\u6709\u8db3\u591f\u7684\u5185\u5b58\uff0c\u624d\u4f1a\u629b\u51fa\u5185\u5b58\u6ea2\u51fa\u5f02\u5e38\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728Java\u4e2d\uff0c\u8f6f\u5f15\u7528\u662f\u7528\u6765\u5b9e\u73b0\u5185\u5b58\u654f\u611f\u7684\u9ad8\u901f\u7f13\u5b58\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u793a\u4f8b\uff1a\u4f7f\u7528<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">java.lang.ref.SoftReference<\/span><\/code><span style=\"font-size: 15px;\">\u7c7b\u53ef\u4ee5\u521b\u5efa\u8f6f\u5f15\u7528\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u5f31\u5f15\u7528\uff08Weak Reference\uff09<\/strong>\uff1a<\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"1073:6-1076:78\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u91cc\u8ba8\u8bbaThreadLocalMap\u4e2dEntry\u7c7b\u7684\u91cd\u70b9\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5f31\u5f15\u7528\u4e5f\u662f\u7528\u6765\u63cf\u8ff0\u975e\u5fc5\u9700\u5bf9\u8c61\u7684\uff0c\u5b83\u7684\u5f3a\u5ea6\u6bd4\u8f6f\u5f15\u7528\u66f4\u5f31\u4e00\u4e9b\uff0c\u88ab\u5f31\u5f15\u7528\u5173\u8054\u7684\u5bf9\u8c61\u53ea\u80fd\u751f\u5b58\u5230\u4e0b\u4e00\u6b21\u5783\u573e\u6536\u96c6\u53d1\u751f\u4e4b\u524d\u3002\u5f53\u5783\u573e\u6536\u96c6\u5668\u5de5\u4f5c\u65f6\uff0c\u65e0\u8bba\u5f53\u524d\u5185\u5b58\u662f\u5426\u8db3\u591f\uff0c\u90fd\u4f1a\u56de\u6536\u88ab\u5f31\u5f15\u7528\u5173\u8054\u7684\u5bf9\u8c61\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728Java\u4e2d\uff0c\u5f31\u5f15\u7528\u662f\u7528\u6765\u63cf\u8ff0\u90a3\u4e9b\u975e\u5173\u952e\u7684\u6570\u636e\uff0c\u5728Java\u91cc\u7528<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">java.lang.ref.WeakReference<\/span><\/code><span style=\"font-size: 15px;\">\u7c7b\u6765\u8868\u793a\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u793a\u4f8b\uff1a\u4f7f\u7528<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">java.lang.ref.WeakReference<\/span><\/code><span style=\"font-size: 15px;\">\u7c7b\u53ef\u4ee5\u521b\u5efa\u5f31\u5f15\u7528\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u865a\u5f15\u7528\uff08Phantom Reference\uff09<\/strong>\uff1a<\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"1078:6-1080:81\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e00\u4e2a\u865a\u5f15\u7528\u5173\u8054\u7740\u7684\u5bf9\u8c61\uff0c\u5728\u4efb\u4f55\u65f6\u5019\u90fd\u53ef\u80fd\u88ab\u5783\u573e\u6536\u96c6\u5668\u56de\u6536\uff0c\u5b83\u4e0d\u80fd\u5355\u72ec\u7528\u6765\u83b7\u53d6\u88ab\u5f15\u7528\u7684\u5bf9\u8c61\u3002\u865a\u5f15\u7528\u5fc5\u987b\u548c\u5f15\u7528\u961f\u5217(<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ReferenceQueue<\/span><\/code><span style=\"font-size: 15px;\">)\u8054\u5408\u4f7f\u7528\u3002\u4e3b\u8981\u7528\u6765\u8ddf\u8e2a\u5bf9\u8c61\u88ab\u5783\u573e\u56de\u6536\u7684\u6d3b\u52a8\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u865a\u5f15\u7528\u5bf9\u4e8e\u4e00\u822c\u7684\u5e94\u7528\u7a0b\u5e8f\u6765\u8bf4\u610f\u4e49\u4e0d\u5927\uff0c\u4e3b\u8981\u4f7f\u7528\u5728\u80fd\u6bd4\u8f83\u7cbe\u786e\u63a7\u5236Java\u5783\u573e\u6536\u96c6\u5668\u7684\u9ad8\u7ea7\u573a\u666f\u4e2d\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u793a\u4f8b\uff1a\u4f7f\u7528<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">java.lang.ref.PhantomReference<\/span><\/code><span style=\"font-size: 15px;\">\u7c7b\u53ef\u4ee5\u521b\u5efa\u865a\u5f15\u7528\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<\/ol>\n<\/blockquote>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5f31\u5f15\u7528\u4e5f\u662f\u7528\u6765\u63cf\u8ff0\u975e\u5fc5\u9700\u5bf9\u8c61\u7684\uff0c\u5b83\u7684\u5f3a\u5ea6\u6bd4\u8f6f\u5f15\u7528\u66f4\u5f31\u4e00\u4e9b\uff0c\u88ab\u5f31\u5f15\u7528\u5173\u8054\u7684\u5bf9\u8c61\u53ea\u80fd\u751f\u5b58\u5230\u4e0b\u4e00\u6b21\u5783\u573e\u6536\u96c6\u53d1\u751f\u4e4b\u524d\u3002\u5f53\u5783\u573e\u6536\u96c6\u5668\u5de5\u4f5c\u65f6\uff0c\u65e0\u8bba\u5f53\u524d\u5185\u5b58\u662f\u5426\u8db3\u591f\uff0c\u90fd\u4f1a\u56de\u6536\u88ab\u5f31\u5f15\u7528\u5173\u8054\u7684\u5bf9\u8c61\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u81f3\u6b64\uff0ckey\u7684\u6cc4\u6f0f\u95ee\u9898\uff0cJDK\u5df2\u7ecf\u5e2e\u6211\u4eec\u987a\u5229\u89e3\u51b3\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u66f4\u590d\u6742\u7684\u662f\uff1a \u5982\u4f55<span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u89e3\u51b3value\u5185\u5b58\u6cc4\u9732\u95ee\u9898\uff1f<\/span><\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u8fd9\u4e2a\u95ee\u9898\uff0c\u7f51\u4e0a\u6709\u4e0a\u4e07\u7bc7\u6587\u7ae0\uff0c \u90fd\u662f\u6284\u6765\u6284\u53bb\uff0c \u6ca1\u6709\u4e00\u7bc7\u6587\u7ae0\u5199\u6e05\u695a\u4e86\u3002<\/span><\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u5927\u5bb6\u770b\u4e86\u90a3\u4e9b\u6587\u7ae0\uff0c\u751a\u81f3\u770b\u4e86\u5f88\u591a\u89c6\u9891\uff0c\u8fd8\u662f\u4e0d\u80fd\u7406\u89e3\u900f\u5f7b\uff0c \u8ff7\u8ff7\u7cca\u7cca\u7684\uff0c \u8bf4\u4e0d\u6e05\u695a\uff0c\u4e5f\u5f88\u5bb9\u6613\u5fd8\u4e86\u3002<\/span><\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u5c3c\u6069\u56e2\u961f\u770b\u4e0d\u4e0b\u53bb\uff0c\u7528\u54b1\u4eec\u7684\u96c4\u539a\u6280\u672f\u5b9e\u529b\uff08\u6d2a\u8352\u4e4b\u529b\uff09\uff0c\u7ed9\u5927\u5bb6\u6765\u4e00\u6b21\u7a7f\u900f\u5f0f\u7684\u89e3\u8bfb\u3002 \u7528\u8fd9\u4e2a \u300aThreadLocal\u5b66\u4e60\u5723\u7ecf\u300b\uff0c\u7b2c\u4e00\u6b21\u5e2e\u52a9\u5927\u5bb6\u641e\u6e05\u695a\u3002<\/span><\/span><\/section>\n<h3 data-sourcepos=\"1088:1-1088:64\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">\u60c5\u51b52\u7684\u89e3\u51b3\u65b9\u6848\uff1a\u6e05\u7406\u7b56\u7565\u89e3\u51b3value\u5185\u5b58\u6cc4\u9732<\/span><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018219\" data-ratio=\"0.7184241019698725\" data-s=\"300,640\"  data-type=\"png\" data-w=\"863\" style=\"text-align: center;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 16px;letter-spacing: normal;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142907247.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018219\" data-ratio=\"0.7184241019698725\" data-s=\"300,640\"  data-type=\"png\" data-w=\"863\" style=\"text-align: center;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 16px;letter-spacing: normal;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142907247.png\"  \/><\/noscript><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e3a\u4e86\u89e3\u51b3value\u5185\u5b58\u6cc4\u9732\u95ee\u9898\uff0cJava \u7684 ThreadLocal \u5b9e\u73b0\u4e86\u4e24\u5927\u6e05\u7406\u65b9\u5f0f\uff1a<\/span><\/section>\n<ul data-sourcepos=\"1094:1-1096:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u63a2\u6d4b\u5f0f\u6e05\u7406\uff08Proactive Cleanup\uff09<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u542f\u53d1\u5f0f\u6e05\u7406\uff08Heuristic Cleanup\uff09 \u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<h3 data-sourcepos=\"1097:1-1097:41\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">\u6e90\u7801\uff1avalue\u7684 \u63a2\u6d4b\u5f0f\u6e05\u7406 \uff1a<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5f53\u7ebf\u7a0b\u8c03\u7528<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocal<\/span><\/code><span style=\"font-size: 15px;\">\u7684<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">get()<\/span><\/code><span style=\"font-size: 15px;\">\u3001<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">set()<\/span><\/code><span style=\"font-size: 15px;\">\u6216<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">remove()<\/span><\/code><span style=\"font-size: 15px;\">\u65b9\u6cd5\u65f6\uff0c\u4f1a\u63a2\u6d4b\u5f0f\u7684\u53bb\u89e6\u53d1\u5bf9 ThreadLocalMap \u7684\u6e05\u7406\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6b64\u65f6\uff0cThreadLocalMap \u4f1a\u68c0\u67e5\u6240\u6709\u952e\uff08ThreadLocal \u5b9e\u4f8b\uff09\uff0c\u5e76\u79fb\u9664\u90a3\u4e9b\u5df2\u7ecf\u88ab\u5783\u573e\u56de\u6536\u7684key\u952e\u53ca\u5176\u5bf9\u5e94\u7684value \u503c\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u79cd\u6e05\u7406\u662f\u4e3b\u52a8\u7684\uff0c\u56e0\u4e3a\u5b83\u662f\u5728\u6bcf\u6b21\u64cd\u4f5c ThreadLocal \u65f6\u8fdb\u884c\u7684\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u63a2\u6d4b\u5f0f\u6e05\u7406\uff08Proactive Cleanup\uff09\u5982\u4f55\u5b9e\u73b0\u7684\u5462\uff1f<\/strong>\uff1a<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4ece\u5f53\u524d\u8282\u70b9\u5f00\u59cb\u904d\u5386\u6570\u7ec4\uff0c\u5c06key\u7b49\u4e8enull\u7684entry\u7f6e\u4e3anull\uff0ckey\u4e0d\u7b49\u4e8enull\u5219rehash\u91cd\u65b0\u5206\u914d\u4f4d\u7f6e\uff0c\u82e5\u91cd\u65b0\u5206\u914d\u4e0a\u7684\u4f4d\u7f6e\u6709\u5143\u7d20\u5219\u5f80\u540e\u987a\u5ef6\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6ce8\u610f\uff1a\u8fd9\u91cc\u628a\u6e05\u7406\u7684\u5f00\u9500\u653e\u5230\u4e86get\u3001set\u64cd\u4f5c\u4e0a\uff0c\u5982\u679cget\u7684\u65f6\u5019\u65e0\u7528Entry\uff08Entry\u7684Key\u4e3anull\uff09\u7279\u522b\u591a\uff0c\u90a3\u8fd9\u6b21get\u76f8\u5bf9\u800c\u8a00\u5c31\u6bd4\u8f83\u6162\u4e86\u3002<\/span><\/section>\n<pre data-sourcepos=\"1111:1-1150:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">int<\/span> <span style=\"color: rgb(183, 85, 1);\">expungeStaleEntry<\/span>(<span style=\"color: rgb(1, 86, 146);\">int<\/span> staleSlot) {            Entry[] tab = table;            <span style=\"color: rgb(1, 86, 146);\">int<\/span> len = tab.length;            <span style=\"color: rgb(101, 110, 119);\">\/\/ expunge entry at staleSlot<\/span>            tab[staleSlot].value = <span style=\"color: rgb(1, 86, 146);\">null<\/span>;            tab[staleSlot] = <span style=\"color: rgb(1, 86, 146);\">null<\/span>;            size--;            <span style=\"color: rgb(101, 110, 119);\">\/\/ Rehash until we encounter null<\/span>            Entry e;            <span style=\"color: rgb(1, 86, 146);\">int<\/span> i;            <span style=\"color: rgb(1, 86, 146);\">for<\/span> (i = nextIndex(staleSlot, len);                 (e = tab[i]) != <span style=\"color: rgb(1, 86, 146);\">null<\/span>;                 i = nextIndex(i, len)) {                ThreadLocal&lt;?&gt; k = e.get();                <span style=\"color: rgb(1, 86, 146);\">if<\/span> (k == <span style=\"color: rgb(1, 86, 146);\">null<\/span>) {                    <span style=\"color: rgb(101, 110, 119);\">\/\/ \u5c06k=null\u7684entry\u7f6e\u4e3anull<\/span>                    e.value = <span style=\"color: rgb(1, 86, 146);\">null<\/span>;                    tab[i] = <span style=\"color: rgb(1, 86, 146);\">null<\/span>;                    size--;                } <span style=\"color: rgb(1, 86, 146);\">else<\/span> {                    <span style=\"color: rgb(101, 110, 119);\">\/\/ k\u4e0d\u4e3anull\uff0c\u5219rehash\u4ece\u65b0\u5206\u914d\u914d\u7f6e<\/span>                    <span style=\"color: rgb(1, 86, 146);\">int<\/span> h = k.threadLocalHashCode &amp; (len - <span style=\"color: rgb(183, 85, 1);\">1<\/span>);                    <span style=\"color: rgb(1, 86, 146);\">if<\/span> (h != i) {                        tab[i] = <span style=\"color: rgb(1, 86, 146);\">null<\/span>;                        <span style=\"color: rgb(101, 110, 119);\">\/\/ Unlike Knuth 6.4 Algorithm R, we must scan until<\/span>                        <span style=\"color: rgb(101, 110, 119);\">\/\/ null because multiple entries could have been stale.<\/span>                        <span style=\"color: rgb(1, 86, 146);\">while<\/span> (tab[h] != <span style=\"color: rgb(1, 86, 146);\">null<\/span>)                            <span style=\"color: rgb(101, 110, 119);\">\/\/ \u91cd\u65b0\u5206\u914d\u540e\u7684\u4f4d\u7f6e\u4e0a\u6709\u5143\u7d20\u5219\u5f80\u540e\u987a\u5ef6\u3002<\/span>                            h = nextIndex(h, len);                        tab[h] = e;                    }                }            }            <span style=\"color: rgb(1, 86, 146);\">return<\/span> i;        }<\/span><\/section><\/pre>\n<h3 data-sourcepos=\"1152:1-1152:39\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">\u6e90\u7801\uff1avalue\u7684\u542f\u53d1\u5f0f\u6e05\u7406\uff1a<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocalMap<\/span><\/code><span style=\"font-size: 15px;\">\u7684 set() \u65b9\u6cd5\u4e2d\uff0c\u6709\u4e00\u4e2a\u9608\u503c\uff08\u9ed8\u8ba4\u4e3a ThreadLocalMap.Entry \u6570\u7ec4\u957f\u5ea6\u7684 1\/4\uff09\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5f53 ThreadLocalMap \u4e2d\u7684 Entry \u5bf9\u8c61\u88ab\u5220\u9664\uff08\u901a\u8fc7\u952e\u7684\u5f31\u5f15\u7528\u88ab\u5783\u573e\u56de\u6536\uff09\u5e76\u4e14\u5269\u4f59\u7684 Entry \u6570\u91cf\u5927\u4e8e\u8fd9\u4e2a\u9608\u503c\u65f6\uff0c\u4f1a\u89e6\u53d1\u4e00\u6b21\u542f\u53d1\u5f0f\u6e05\u7406\u64cd\u4f5c\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u79cd\u6e05\u7406\u662f\u542f\u53d1\u5f0f\u7684\uff0c\u56e0\u4e3a\u5b83\u4e0d\u662f\u6bcf\u6b21\u64cd\u4f5c\u90fd\u8fdb\u884c\uff0c\u800c\u662f\u57fa\u4e8e\u4e00\u5b9a\u7684\u6761\u4ef6\u548c\u6982\u7387\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u542f\u53d1\u5f0f\u6e05\u7406\uff08Heuristic Cleanup\uff09\u5982\u4f55\u5b9e\u73b0\uff1f<\/strong>\uff1a<\/span><\/section>\n<blockquote data-sourcepos=\"1162:1-1162:226\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4ece\u5f53\u524d\u8282\u70b9\u5f00\u59cb\uff0c\u8fdb\u884cdo-while\u5faa\u73af\u68c0\u67e5\u6e05\u7406\u8fc7\u671fkey\uff0c\u7ed3\u675f\u6761\u4ef6\u662f\u8fde\u7eedn\u6b21\u672a\u53d1\u73b0\u8fc7\u671fkey\u5c31\u8df3\u51fa\u5faa\u73af\uff0cn\u662f\u7ecf\u8fc7\u4f4d\u8fd0\u7b97\u8ba1\u7b97\u5f97\u51fa\u7684\uff0c\u53ef\u4ee5\u7b80\u5355\u7406\u89e3\u4e3a\u6570\u7ec4\u957f\u5ea6\u76842\u7684\u591a\u5c11\u6b21\u5e42\u6b21\u3002<\/span><\/section>\n<\/blockquote>\n<pre data-sourcepos=\"1164:1-1181:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">boolean<\/span> <span style=\"color: rgb(183, 85, 1);\">cleanSomeSlots<\/span>(<span style=\"color: rgb(1, 86, 146);\">int<\/span> i, <span style=\"color: rgb(1, 86, 146);\">int<\/span> n) {            <span style=\"color: rgb(1, 86, 146);\">boolean<\/span> removed = <span style=\"color: rgb(1, 86, 146);\">false<\/span>;            Entry[] tab = table;            <span style=\"color: rgb(1, 86, 146);\">int<\/span> len = tab.length;            <span style=\"color: rgb(1, 86, 146);\">do<\/span> {                i = nextIndex(i, len);                Entry e = tab[i];                <span style=\"color: rgb(1, 86, 146);\">if<\/span> (e != <span style=\"color: rgb(1, 86, 146);\">null<\/span> &amp;&amp; e.get() == <span style=\"color: rgb(1, 86, 146);\">null<\/span>) {                    n = len;                    removed = <span style=\"color: rgb(1, 86, 146);\">true<\/span>;                    <span style=\"color: rgb(101, 110, 119);\">\/\/ \u79fb\u9664<\/span>                    i = expungeStaleEntry(i);                }            } <span style=\"color: rgb(1, 86, 146);\">while<\/span> ( (n &gt;&gt;&gt;= <span style=\"color: rgb(183, 85, 1);\">1<\/span>) != <span style=\"color: rgb(183, 85, 1);\">0<\/span>);            <span style=\"color: rgb(1, 86, 146);\">return<\/span> removed;        }<\/span><\/section><\/pre>\n<h3 data-sourcepos=\"1183:1-1183:55\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">\u4e1a\u52a1\u4e3b\u52a8\u6e05\u7406\uff1a\u624b\u52a8\u6e05\u9664\u89e3\u51b3\u5185\u5b58\u6cc4\u9732<\/span><\/h3>\n<section style=\"margin-bottom: 16px;text-wrap: wrap;font-size: 16px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8981\u77e5\u9053\uff0cThreadLocal\u7684\u4e00\u4e2a\u5e38\u89c1\u95ee\u9898\u662f\u5185\u5b58\u6cc4\u9732\u3002<\/span><\/section>\n<section style=\"margin-bottom: 16px;text-wrap: wrap;font-size: 16px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u901a\u5e38\u53d1\u751f\u5728\u4f7f\u7528\u7ebf\u7a0b\u6c60\u7684\u573a\u666f\u4e2d\uff0c\u56e0\u4e3a\u7ebf\u7a0b\u6c60\u4e2d\u7684\u7ebf\u7a0b\u901a\u5e38\u662f\u957f\u671f\u5b58\u5728\u7684\uff0c\u5b83\u4eec\u7684ThreadLocal\u53d8\u91cf\u4e5f\u4e0d\u4f1a\u81ea\u52a8\u6e05\u7406\uff0c\u8fd9\u53ef\u80fd\u5bfc\u81f4\u5185\u5b58\u6cc4\u6f0f\u3002<\/span><\/section>\n<section style=\"margin-bottom: 16px;text-wrap: wrap;font-size: 16px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u524d\u9762\u8bb2\u4e86\uff0cJDK\u5df2\u7ecf\u7528\u5c3d\u5168\u529b\u53bb\u89e3\u51b3\u4e86\uff0cJDK\u7528\u4e86\u4e09\u4e2a\u529e\u6cd5\uff0c\u6765\u89e3\u51b3\u5185\u5b58\u6cc4\u6f0f\u3002<\/span><\/section>\n<section style=\"margin-bottom: 16px;text-wrap: wrap;font-size: 16px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u5c3d\u7ba1\u6709\u5f31<\/span><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u5f15\u7528\u4ee5\u53ca\u8fd9\u4e9b\u6e05\u7406\u673a\u5236\uff0c\u4f46\u6700\u4f73\u5b9e\u8df5\u4e1a\u52a1\u4e3b\u52a8\u6e05\u7406\uff0c<\/span><\/span><\/section>\n<section style=\"margin-bottom: 16px;text-wrap: wrap;font-size: 16px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e1a\u52a1\u4e0a\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u4e00\u4e2a\u65b9\u6cd5\u662f\uff0c\u6bcf\u5f53\u4f7f\u7528\u5b8cThreadLocal\u53d8\u91cf\u540e\uff0c\u663e\u5f0f\u5730\u8c03\u7528<\/span><code style=\"padding: 0.14em 0.3em;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">remove()<\/span><\/code><span style=\"font-size: 15px;\">\u65b9\u6cd5\u6765\u6e05\u9664\u5b83\uff1a<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5982\u4f55\u4e1a\u52a1\u4e3b\u52a8\u6e05\u7406\uff1f\u5728\u4f7f\u7528\u5b8c ThreadLocal \u540e\u663e\u5f0f\u8c03\u7528<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">remove()\u65b9\u6cd5<\/span><\/code><span style=\"font-size: 15px;\">\uff0c\u4ee5\u786e\u4fdd\u4e0d\u518d\u9700\u8981\u7684\u503c\u80fd\u591f\u88ab\u53ca\u65f6\u56de\u6536\uff0ckey\u548cvalue \u90fd\u540c\u65f6\u6e05\u7406\uff0c\u4e00\u9505\u7aef\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u6f5c\u5728\u7684\u5185\u5b58\u6cc4\u6f0f\u95ee\u9898\uff0c\u5e76\u51cf\u5c11\u5783\u573e\u56de\u6536\u7684\u538b\u529b\u3002<\/span><\/section>\n<section style=\"margin-bottom: 16px;text-wrap: wrap;font-size: 16px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8bb2\u5230\u8fd9\u91cc\uff0c\u5c3c\u6069\u56e2\u961f\u7ed9\u5927\u5bb6\uff0c\u7528\u4e00\u4e2a\u5927\u7684\u56fe\u603b\u7ed3\u4e00\u4e0b ThreadLocal\u7684\u5185\u5b58\u6cc4\u9732\u4e0e\u89e3\u51b3\u65b9\u6848\uff0c\u5177\u4f53\u5982\u4e0b\uff1a<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018220\" data-ratio=\"0.7302857142857143\" data-s=\"300,640\"  data-type=\"png\" data-w=\"875\" style=\"text-align: center;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142910313.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018220\" data-ratio=\"0.7302857142857143\" data-s=\"300,640\"  data-type=\"png\" data-w=\"875\" style=\"text-align: center;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142910313.png\"  \/><\/noscript><\/section>\n<section style=\"margin-bottom: 16px;text-wrap: wrap;font-size: 16px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><\/section>\n<section style=\"margin-bottom: 16px;text-wrap: wrap;font-size: 16px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6b64\u56fe\uff0c\u662f\u5168\u7f51\u7684\u7b2c\u4e00\u5f20\u5f7b\u5e95\u7a7f\u900f\u5f0f\u7684\u89e3\u8bfb<span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">ThreadLocal\u7684\u5185\u5b58\u6cc4\u9732\u56fe<\/span>\u3002 \u7528\u8fd9\u4e2a\u56fe\uff0c\u7b2c\u4e00\u6b21\u5e2e\u52a9\u5927\u5bb6\u641e\u6e05\u695a\u590d\u6742\u7684<span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">ThreadLocal\u7684\u5185\u5b58\u6cc4\u9732<\/span>\u3002<\/span><\/section>\n<section style=\"letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><\/span>\u8fd9\u5f20\u56fe\u5f88\u5bb9\u6613\u7406\u89e3\uff0c\u5f88\u5bb9\u6613\u8bb0\u5fc6\u3002\u5927\u5bb6\u53ef\u6536\u85cf\u8d77\u6765\uff0c \u9762\u8bd5\u4e4b\u524d\u590d\u4e60\u4e00\u4e0b\uff0c<strong>\u4e00\u5b9a\u80fd\u540a\u6253\u9762\u8bd5\u5b98\u3002<\/strong><\/span><\/section>\n<section style=\"letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u4e0d\u5bf9\uff0c\u662f\u540a\u6b7b\u9762\u8bd5\u5b98\u3002<\/strong><\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u5c3c\u6069\u56e2\u961f\u7528\u6df1\u539a\u7684\u67b6\u6784\u529f\u529b\uff0c\u975e\u5e38\u559c\u6b22\u3001\u975e\u5e38\u5584\u4e8e\u628a\u590d\u6742\u7684\u95ee\u9898\u505a\u6e05\u6670\u6df1\u5165\u7684\u7a7f\u900f\u5f0f\u68b3\u7406<span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u6bd4<\/span><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u5982\uff1a<\/span><\/span><\/span><\/section>\n<ul class=\"list-paddingleft-1\" style=\"list-style-type: disc;\">\n<li>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u6bd4<\/span><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u5982<\/span>Netty\u7684\u5185\u5b58\u6c60\u548c\u5bf9\u8c61\u6c60\uff08\u90a3\u4e2a\u8d85\u7ea7\u96be\uff0c\u5f88\u591a\u4eba\u7a77\u5176\u4e00\u751f\u90fd\u641e\u4e0d\u61c2\uff09<span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\uff0c<\/span><\/span><\/span><\/section>\n<\/li>\n<li>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u6bd4\u5982DDD\u7684\u5efa\u6a21\u548c\u843d\u5730\uff0c<\/span><\/span><\/span><\/section>\n<\/li>\n<li>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u6bd4\u5982Caffeine\u7684\u5e95\u5c42\u67b6\u6784\uff0c<\/span><\/span><\/span><\/section>\n<\/li>\n<li>\n<p>\u6bd4\u5982\u9ad8\u6027\u80fd\u8475\u82b1\u5b9d\u5178<\/p>\n<\/li>\n<li>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u7b49\u7b49\u7b49\u7b49\u3002<\/span><\/span><\/span><\/section>\n<\/li>\n<\/ul>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"> \u638c\u63e1\u8fd9\u4e2a\u6280\u672f\u96be\u9898\uff0c\u5e2e\u52a9\u5927\u5bb6\u63d0\u5347\u6280\u672f\u7684\u6838\u5fc3\u5185\u529f\u3002 \u5efa\u8bae\u5927\u5bb6\u53bb\u770b\u770b\u5c3c\u6069\u7684\u8fd9\u4e9b\u6838\u5fc3\u5185\u5bb9\u3002<\/span><\/span><\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u800c\u4e14\uff0c\u5c3c\u6069\u56e2\u961f\u6b63\u5728\u7528<span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u6df1\u539a\u7684\u67b6\u6784\u529f\u529b\uff0c \u5e2e\u52a9\u5927\u5bb6\u6765\u4e00\u4e2a\u771f\u6b63\u7684\u67b6\u6784\u7248\u672c\u7684AI\u67b6\u6784\uff0c\u5e2e\u52a9\u5927\u5bb6\u7a7f\u900fAI\u67b6\u6784\u3002<\/span><\/span><\/span><\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u626f\u8fdc\u4e86\uff0c\u8a00\u5f52\u6b63\u4f20\u3002<\/span><\/span><\/span><\/span><\/section>\n<h2 data-sourcepos=\"1203:1-1203:50\" style=\"font-weight: bold;font-size: 22px;margin: 10px auto 5px;border-top-width: 1px;border-top-style: solid;border-top-color: rgb(242, 242, 242);background-color: rgb(242, 242, 242);\"><span style=\"margin-top: -1px;padding-top: 14px;padding-bottom: 14px;padding-right: 5px;padding-left: 5px;font-size: 17px;border-top: 4px solid rgb(33, 33, 34);display: inline-block;line-height: 1.5;font-weight: normal;background-color: rgb(30, 30, 30);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 20px;padding-left: 10px;\">\u4f7f\u7528ThreadLocal\u7684\u6027\u80fd\u95ee\u9898\u548c\u4f18\u5316\u63aa\u65bd<\/span><\/h2>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u867d\u7136ThreadLocal\u63d0\u4f9b\u4e86\u5f88\u65b9\u4fbf\u7684\u7ebf\u7a0b\u9694\u79bb\u673a\u5236\uff0c\u4f46\u6709\u6027\u80fd\u635f\u8017\u7684\u3002<\/span><\/section>\n<h3 data-sourcepos=\"1207:1-1207:30\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">ThreadLocal\u7684\u6027\u80fd\u5f00\u9500<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u7684\u6027\u80fd\u5f00\u9500\u4e3b\u8981\u6765\u81ea\u4e24\u4e2a\u65b9\u9762\uff1a<\/span><\/section>\n<blockquote data-sourcepos=\"1211:1-1212:42\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<ul data-sourcepos=\"1211:3-1212:42\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocalMap\u7684\u7ef4\u62a4\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u53d8\u91cf\u7684\u521b\u5efa\u548c\u9500\u6bc1\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<\/blockquote>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728\u4f7f\u7528ThreadLocal\u65f6\uff0c\u5c24\u5176\u662f\u5728\u9ad8\u5e76\u53d1\u7684\u73af\u5883\u4e0b\uff0c\u8981\u6ce8\u610f\u5176\u5bf9\u6027\u80fd\u7684\u5f71\u54cd\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u56e0\u6b64\uff0c\u5728\u4f7f\u7528ThreadLocal\u65f6\uff0c\u8981\u5c3d\u91cf\u590d\u7528\u3001\u91cd\u7528ThreadLocal\u53d8\u91cf\uff0c\u907f\u514d\u5728\u9ad8\u9891\u7387\u7684\u64cd\u4f5c\u4e2d\u9891\u7e41\u5730\u521b\u5efa\u548c\u9500\u6bc1\u5b83\u4eec\u3002`<\/span><\/section>\n<h3 data-sourcepos=\"1220:1-1220:68\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">\u7f16\u7a0b\u89c4\u8303\uff1a\u63a8\u8350\u4f7f\u7528 static final \u4fee\u9970ThreadLocal\u5bf9\u8c61<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5982\u4f55 \u8981\u5c3d\u91cf\u590d\u7528\u3001\u91cd\u7528ThreadLocal\u53d8\u91cf\uff1f<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7f16\u7a0b\u89c4\u8303\u6709\u4e91\uff1aThreadLocal \u5b9e\u4f8b\u4f5c\u4e3aThreadLocalMap\u7684Key\uff0c\u9488\u5bf9\u4e00\u4e2a\u7ebf\u7a0b\u5185\u6240\u6709\u64cd\u4f5c\u662f\u5171\u4eab\u7684\uff0c\u6240\u4ee5\u5efa\u8bae\u8bbe\u7f6estatic\u4fee\u9970\u7b26\uff0c\u4ee5\u4fbf\u88ab\u6240\u6709\u7684\u5bf9\u8c61\u5171\u4eab\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7531\u4e8e\u9759\u6001\u53d8\u91cf\u4f1a\u5728\u7c7b\u7b2c\u4e00\u6b21\u88ab\u4f7f\u7528\u65f6\u88c5\u8f7d\uff0c\u53ea\u4f1a\u5206\u914d\u4e00\u6b21\u5b58\u50a8\u7a7a\u95f4\uff0c\u6b64\u7c7b\u7684\u6240\u6709\u5b9e\u4f8b\u90fd\u4f1a\u5171\u4eab\u8fd9\u4e2a\u5b58\u50a8\u7a7a\u95f4\uff0c\u6240\u4ee5\u4f7f\u7528<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">static<\/span><\/code><span style=\"font-size: 15px;\">\u4fee\u9970ThreadLocal \u5c31\u4f1a\u8282\u7ea6\u5185\u5b58\u7a7a\u95f4\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u53e6\u5916\uff0c\u4e3a\u4e86\u786e\u4fddThreadLocal \u5b9e\u4f8b\u7684\u552f\u4e00\u6027\uff0c\u9664\u4e86\u4f7f\u7528static\u4fee\u9970\u4e4b\u5916\uff0c\u8fd8\u4f1a\u4f7f\u7528<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">final<\/span><\/code><span style=\"font-size: 15px;\">\u8fdb\u884c\u52a0\u5f3a\u4fee\u9970\uff0c\u4ee5\u9632\u6b62\u5176\u5728\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u53d1\u751f\u52a8\u6001\u53d8\u66f4\u3002\u53c2\u8003\u7684\u5b9e\u4f8b\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"1230:1-1233:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"> <section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(101, 110, 119);\">\/\/\u63a8\u8350\u4f7f\u7528static final\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf<\/span> <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> ThreadLocal&lt;Foo&gt; LOCAL_FOO = <span style=\"color: rgb(1, 86, 146);\">new<\/span> ThreadLocal&lt;Foo&gt;();<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4ee5\u4e0a\u4ee3\u7801\uff0c\u4e3a\u4ec0\u4e48ThreadLocal\u5b9e\u4f8b\u9664\u4e86\u6dfb\u52a0static final \u4fee\u9970\u4e4b\u540e\uff0c\u8fd8\u5e38\u5e38\u52a0\u4e0a\u4e86<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">private<\/span><\/code><span style=\"font-size: 15px;\">\u4fee\u9970\u5462\uff1f<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e3b\u8981\u76ee\u7684\u662f \u7f29\u5c0f\u4f7f\u7528\u7684\u8303\u56f4\uff0c\u5c3d\u53ef\u80fd\u4e0d\u8ba9\u4ed6\u4eba\u5f15\u7528\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u51e1\u4e8b\u90fd\u6709\u4e24\u9762\u6027\uff0c\u4f7f\u7528static \u3001final\u4fee\u9970ThreadLocal\u5b9e\u4f8b\u4e5f\u4f1a\u5e26\u6765\u526f\u4f5c\u7528\uff1a \u5185\u5b58\u6cc4\u6f0f\u3002<\/span><\/section>\n<ul data-sourcepos=\"1241:1-1246:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e3a\u5565\u5185\u5b58\u6cc4\u9732\u53c8\u51fa\u6765\u4e86\uff1f<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e0a\u9762\u4e0d\u662f\u89e3\u51b3\u4e86\u5417\uff1f<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u545c\u545c\u545c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<\/span><\/section>\n<\/li>\n<\/ul>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7531\u4e8e\u4f7f\u7528static \u3001final\u4fee\u9970TheadLocal\u5bf9\u8c61\u5b9e\u4f8b\uff0c \u5bfc\u81f4\u4e86\u54b1\u4eec\u8fd9\u4e2a\u88ab ThreadLocalMap\u4e2dEntry\u7684Key\u6240\u5f15\u7528\u7684ThreadLocal\u5bf9\u8c61\u5b9e\u4f8b\uff0c\u4e00\u76f4\u5b58\u5728\u5f3a\u5f15\u7528\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u91cc\u6709\u4e00\u4e2a\u4e25\u91cd\u540e\u679c\uff0c\u8fd9\u4e2a \u4f7f\u7528static \u3001final\u4fee\u9970TheadLocal\u5bf9\u8c61\u5b9e\u4f8b \u4e00\u76f4\u4e0d\u4f1a\u88abGC\uff0c\u4e00\u76f4\u5b58\u5728\uff0c\u4e00\u76f4\u5b58\u5728\u3002<\/span><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018221\" data-ratio=\"0.6568825910931174\" data-s=\"300,640\"  data-type=\"png\" data-w=\"988\" style=\"text-align: center;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142912535.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018221\" data-ratio=\"0.6568825910931174\" data-s=\"300,640\"  data-type=\"png\" data-w=\"988\" style=\"text-align: center;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142912535.png\"  \/><\/noscript><\/section>\n<h3 data-sourcepos=\"1257:1-1257:74\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">TheadLocal\u5bf9\u8c61\u5b9e\u4f8b\u5b58\u5728\u5f3a\u5f15\u7528\uff0c\u4f1a\u5bfc\u81f4\u4e09\u4e2a\u5f7b\u5e95\u5931\u6548\uff1a<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u4e2a\u5730\u65b9\uff0c\u53c8\u5f88\u91cd\u8981\u4e86\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u4f7f\u7528static \u3001final\u4fee\u9970ThreadLocal\u5b9e\u4f8b\u4e5f\u4f1a\u5e26\u6765\u526f\u4f5c\u7528<\/span><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\uff1a \u5185\u5b58\u6cc4\u6f0f\u3002<\/span><\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u4ec0\u4e48\u526f\u4f5c\u7528\u5462\uff1f<span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u4f7f\u7528static \u3001final\u4fee\u9970Thread<\/span><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">Local\u5b9e\u4f8b\uff0c\u5bfc\u81f4\u4e86\u4e24\u4e2a\u6076\u679c\uff1a<\/span><\/span><\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6076\u679c1\uff1a\u5bfc\u81f4JDK\u89e3\u51b3key\u5185\u5b58\u6cc4\u9732\u95ee\u9898\u7684\u5f31\u5f15\u7528\u6e05\u7406\u65b9\u5f0f\u5f7b\u5e95\u5931\u6548\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;font-size: 15px;letter-spacing: normal;text-align: start;caret-color: rgb(36, 41, 46);text-wrap: wrap;\">\u6076\u679c2\uff1a<\/span>\u5bfc\u81f4JDK\u89e3\u51b3value\u5185\u5b58\u6cc4\u9732\u95ee\u9898\u7684\u4e24\u5927\u6e05\u7406\u65b9\u5f0f\u5f7b\u5e95\u5931\u6548\u3002<\/span><\/section>\n<ul data-sourcepos=\"1263:1-1265:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u63a2\u6d4b\u5f0f\u6e05\u7406\uff08Proactive Cleanup\uff09 \u5f7b\u5e95\u5931\u6548<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u542f\u53d1\u5f0f\u6e05\u7406\uff08Heuristic Cleanup\uff09\u5f7b\u5e95\u5931\u6548 \u3002<\/span><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018227\" data-ratio=\"0.7753058954393771\" data-s=\"300,640\"  data-type=\"png\" data-w=\"899\" style=\"text-align: center;font-size: 16px;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142918494.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018227\" data-ratio=\"0.7753058954393771\" data-s=\"300,640\"  data-type=\"png\" data-w=\"899\" style=\"text-align: center;font-size: 16px;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142918494.png\"  \/><\/noscript><\/section>\n<\/li>\n<\/ul>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u4f7f\u5f97Thread\u5b9e\u4f8b\u5185\u90e8\u7684ThreadLocalMap\u4e2dEntry\u7684Key\u5728Thread\u5b9e\u4f8b\u7684\u751f\u547d\u671f\u5185\u5c06\u59cb\u7ec8\u4fdd\u6301\u4e3a\u975enull\uff0c\u4ece\u800c\u5bfc\u81f4Key\u6240\u5728\u7684Entry\u4e0d\u4f1a\u88ab\u81ea\u52a8\u6e05\u7a7a\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4Entry\u4e2d\u7684Value\u6307\u5411\u7684\u5bf9\u8c61\u4e00\u76f4\u5b58\u5728\u5f3a\u5f15\u7528\uff0cValue\u6307\u5411\u7684\u5bf9\u8c61\u5728\u7ebf\u7a0b\u751f\u547d\u671f\u5185\u4e0d\u4f1a\u88ab\u91ca\u653e\uff0c\u6700\u7ec8\u5bfc\u81f4\u5185\u5b58\u6cc4\u9732\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6240\u4ee5\uff0c\u4f7f\u7528static \u3001final\u4fee\u9970TheadLocal\u5b9e\u4f8b\uff0c\u4f7f\u7528\u5b8c\u540e\u5fc5\u987b\u4f7f\u7528<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">remove\uff08\uff09<\/span><\/code><span style=\"font-size: 15px;\">\u8fdb\u884c\u624b\u52a8\u91ca\u653e\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5982\u679c\u4f7f\u7528\u7ebf\u7a0b\u6c60\uff0c\u53ef\u4ee5\u5b9a\u5236\u7ebf\u7a0b\u6c60\u7684<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">afterExecute<\/span><\/code><span style=\"font-size: 15px;\">\u65b9\u6cd5\uff08\u4efb\u52a1\u6267\u884c\u5b8c\u6210\u4e4b\u540e\u7684\u94a9\u5b50\u65b9\u6cd5\uff09\uff0c\u5728\u4efb\u52a1\u6267\u884c\u5b8c\u6210\u4e4b\u540e\uff0c\u8c03\u7528TheadLocal\u5b9e\u4f8b\u7684<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">remove\uff08\uff09\u65b9\u6cd5<\/span><\/code><span style=\"font-size: 15px;\">\u5bf9\u5176\u624b\u52a8\u91ca\u653e\uff0c\u4ece\u800c\u5b9e\u73b0\u7684\u5176\u7ebf\u7a0b\u5185\u90e8\u7684Entry\u5f97\u5230\u91ca\u653e\uff0c\u53c2\u8003\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/span><\/section>\n<pre data-sourcepos=\"1276:1-1292:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\">    <section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(101, 110, 119);\">\/\/\u7ebf\u7a0b\u672c\u5730\u53d8\u91cf,\u7528\u4e8e\u8bb0\u5f55\u7ebf\u7a0b\u5f02\u6b65\u4efb\u52a1\u7684\u5f00\u59cb\u6267\u884c\u65f6\u95f4<\/span>  <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> ThreadLocal&lt;Long&gt; START_TIME= <span style=\"color: rgb(1, 86, 146);\">new<\/span> ThreadLocal&lt;&gt;();     ExecutorService pool = <span style=\"color: rgb(1, 86, 146);\">new<\/span> ThreadPoolExecutor(<span style=\"color: rgb(183, 85, 1);\">2<\/span>,            <span style=\"color: rgb(183, 85, 1);\">4<\/span>, <span style=\"color: rgb(183, 85, 1);\">60<\/span>,            TimeUnit.SECONDS, <span style=\"color: rgb(1, 86, 146);\">new<\/span> LinkedBlockingQueue&lt;&gt;(<span style=\"color: rgb(183, 85, 1);\">2<\/span>)) {           ...\u7701\u7565\u5176\u4ed6                    <span style=\"color: rgb(101, 110, 119);\">\/\/\u5f02\u6b65\u4efb\u52a1\u6267\u884c\u5b8c\u6210\u4e4b\u540e\u7684\u94a9\u5b50\u65b9\u6cd5<\/span>            <span style=\"color: rgb(1, 86, 146);\">@Override<\/span>            <span style=\"color: rgb(1, 86, 146);\">protected<\/span> <span style=\"color: rgb(1, 86, 146);\">void<\/span> <span style=\"color: rgb(183, 85, 1);\">afterExecute<\/span>(Runnable target, Throwable t)            {              ...\u7701\u7565\u5176\u4ed6                        <span style=\"color: rgb(101, 110, 119);\">\/\/\u6e05\u7a7aTheadLocal\u5b9e\u4f8b\u7684\u672c\u5730\u503c<\/span>                startTime.remove();            }  };<\/span><\/section><\/pre>\n<h2 data-sourcepos=\"1296:1-1296:71\" style=\"font-weight: bold;font-size: 22px;margin: 10px auto 5px;border-top-width: 1px;border-top-style: solid;border-top-color: rgb(242, 242, 242);background-color: rgb(242, 242, 242);\"><span style=\"margin-top: -1px;padding-top: 14px;padding-bottom: 14px;padding-right: 5px;padding-left: 5px;font-size: 17px;border-top: 4px solid rgb(33, 33, 34);display: inline-block;line-height: 1.5;font-weight: normal;background-color: rgb(30, 30, 30);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 20px;padding-left: 10px;\">ThreadLocal\u5347\u7ea7\u72481\uff1aInheritableThreadLocal \u53ef\u7ee7\u627f\u672c\u5730\u53d8\u91cf<\/span><\/h2>\n<h3 data-sourcepos=\"1298:1-1298:70\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">\u4ec0\u4e48\u662f\u53ef\u7ee7\u627f\u672c\u5730\u53d8\u91cfInheritableThreadLocal\uff08ITL\uff09?<\/span><\/h3>\n<blockquote data-sourcepos=\"1300:1-1302:108\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6587\u6863\u592a\u957f\uff0c\u8d85\u8fc7\u4e86 \u5e73\u53f0\u9650\u5236........<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u90e8\u5206\u8be6\u7ec6\u5185\u5bb9\u7565\uff0c\u8bf7\u53c2\u89c1PDF \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b<\/span><\/section>\n<\/blockquote>\n<h3 data-sourcepos=\"1304:1-1304:41\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">InheritableThreadLocal\u7684\u57fa\u672c\u4f7f\u7528<\/span><\/h3>\n<blockquote data-sourcepos=\"1308:1-1310:108\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6587\u6863\u592a\u957f\uff0c\u8d85\u8fc7\u4e86 \u5e73\u53f0\u9650\u5236........<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u90e8\u5206\u8be6\u7ec6\u5185\u5bb9\u7565\uff0c\u8bf7\u53c2\u89c1PDF \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b<\/span><\/section>\n<\/blockquote>\n<h3 data-sourcepos=\"1314:1-1314:41\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">InheritableThreaLocal\u7684\u539f\u7406\u5206\u6790<\/span><\/h3>\n<blockquote data-sourcepos=\"1320:1-1322:108\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6587\u6863\u592a\u957f\uff0c\u8d85\u8fc7\u4e86 \u5e73\u53f0\u9650\u5236........<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u90e8\u5206\u8be6\u7ec6\u5185\u5bb9\u7565\uff0c\u8bf7\u53c2\u89c1PDF \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b<\/span><\/section>\n<\/blockquote>\n<h3 data-sourcepos=\"1326:1-1326:44\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">InheritableThreaLocal\u6240\u5e26\u6765\u7684\u95ee\u9898<\/span><\/h3>\n<blockquote data-sourcepos=\"1332:1-1334:108\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6587\u6863\u592a\u957f\uff0c\u8d85\u8fc7\u4e86 \u5e73\u53f0\u9650\u5236........<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u90e8\u5206\u8be6\u7ec6\u5185\u5bb9\u7565\uff0c\u8bf7\u53c2\u89c1PDF \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b<\/span><\/section>\n<\/blockquote>\n<h2 data-sourcepos=\"1340:1-1340:73\" style=\"font-weight: bold;font-size: 22px;margin: 10px auto 5px;border-top-width: 1px;border-top-style: solid;border-top-color: rgb(242, 242, 242);background-color: rgb(242, 242, 242);\"><span style=\"margin-top: -1px;padding-top: 14px;padding-bottom: 14px;padding-right: 5px;padding-left: 5px;font-size: 17px;border-top: 4px solid rgb(33, 33, 34);display: inline-block;line-height: 1.5;font-weight: normal;background-color: rgb(30, 30, 30);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 20px;padding-left: 10px;\">ThreadLocal\u5347\u7ea7\u72482\uff1aTransmittableThreadLocal \u53ef\u900f\u4f20\u672c\u5730\u53d8\u91cf<\/span><\/h2>\n<blockquote data-sourcepos=\"1344:1-1346:108\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6587\u6863\u592a\u957f\uff0c\u8d85\u8fc7\u4e86 \u5e73\u53f0\u9650\u5236........<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u90e8\u5206\u8be6\u7ec6\u5185\u5bb9\u7565\uff0c\u8bf7\u53c2\u89c1PDF \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b<\/span><\/section>\n<\/blockquote>\n<h3 data-sourcepos=\"1350:1-1350:49\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">\u4ec0\u4e48\u662fTransmittableThreadLocal\uff08TTL\uff09\uff1f<\/span><\/h3>\n<blockquote data-sourcepos=\"1354:1-1356:108\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6587\u6863\u592a\u957f\uff0c\u8d85\u8fc7\u4e86 \u5e73\u53f0\u9650\u5236........<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u90e8\u5206\u8be6\u7ec6\u5185\u5bb9\u7565\uff0c\u8bf7\u53c2\u89c1PDF \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b<\/span><\/section>\n<\/blockquote>\n<h3 data-sourcepos=\"1360:1-1360:20\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">TTL \u4f7f\u7528\u573a\u666f<\/span><\/h3>\n<blockquote data-sourcepos=\"1364:1-1366:108\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6587\u6863\u592a\u957f\uff0c\u8d85\u8fc7\u4e86 \u5e73\u53f0\u9650\u5236........<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u90e8\u5206\u8be6\u7ec6\u5185\u5bb9\u7565\uff0c\u8bf7\u53c2\u89c1PDF \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b<\/span><\/section>\n<\/blockquote>\n<h3 data-sourcepos=\"1370:1-1370:43\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">TransmittableThreadLocal\u7684\u539f\u7406\u5206\u6790<\/span><\/h3>\n<blockquote data-sourcepos=\"1374:1-1376:108\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6587\u6863\u592a\u957f\uff0c\u8d85\u8fc7\u4e86 \u5e73\u53f0\u9650\u5236........<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u90e8\u5206\u8be6\u7ec6\u5185\u5bb9\u7565\uff0c\u8bf7\u53c2\u89c1PDF \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b<\/span><\/section>\n<\/blockquote>\n<h3 data-sourcepos=\"1382:1-1382:75\" style=\"letter-spacing: normal;text-align: start;white-space: normal;margin-top: 14px;margin-bottom: 16px;font-size: 1.25em;font-weight: 600;padding-top: 10px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u3001InheritableThreaLocal\u4e0eTransmittableThreadLocal\u7684\u6bd4\u8f83<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>ThreadLocal<\/strong>\u3001<strong>InheritableThreadLocal<\/strong>\u4e0e<strong>TransmittableThreadLocal<\/strong>\u5728Java\u4e2d\u90fd\u662f\u7528\u4e8e\u5904\u7406\u7ebf\u7a0b\u5c40\u90e8\u53d8\u91cf\u7684\u5de5\u5177\uff0c\u4f46\u5b83\u4eec\u5728\u4f7f\u7528\u573a\u666f\u548c\u7279\u6027\u4e0a\u6709\u6240\u4e0d\u540c\u3002<\/span><\/section>\n<ol data-sourcepos=\"1386:1-1412:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal<\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"1390:6-1392:151\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u4f7f\u7528\u573a\u666f<\/strong>\uff1a\u9002\u7528\u4e8e\u9700\u8981\u5728\u7ebf\u7a0b\u5185\u90e8\u5b58\u50a8\u548c\u83b7\u53d6\u6570\u636e\uff0c\u4e14\u4e0d\u5e0c\u671b\u4e0e\u5176\u4ed6\u7ebf\u7a0b\u5171\u4eab\u6570\u636e\u7684\u573a\u666f\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u53d8\u91cf\u5b58\u50a8<\/strong>\uff1a\u63d0\u4f9b\u4e86\u4e00\u79cd\u5728\u7ebf\u7a0b\u5185\u90e8\u5b58\u50a8\u53d8\u91cf\u7684\u673a\u5236\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u53ef\u4ee5\u72ec\u7acb\u5730\u6539\u53d8\u81ea\u5df1\u7684\u526f\u672c\uff0c\u800c\u4e0d\u4f1a\u5f71\u54cd\u5230\u5176\u4ed6\u7ebf\u7a0b\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u7ebf\u7a0b\u9694\u79bb<\/strong>\uff1a\u901a\u8fc7\u4e3a\u6bcf\u4e2a\u7ebf\u7a0b\u521b\u5efa\u53d8\u91cf\u526f\u672c\uff0cThreadLocal\u5b9e\u73b0\u4e86\u7ebf\u7a0b\u95f4\u7684\u6570\u636e\u9694\u79bb\uff0c\u63d0\u9ad8\u4e86\u591a\u7ebf\u7a0b\u7a0b\u5e8f\u7684\u6027\u80fd\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<ul data-sourcepos=\"1388:4-1394:0\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u5b9a\u4e49<\/strong>\uff1aThreadLocal\u662fJava\u4e2d\u4e00\u4e2a\u975e\u5e38\u91cd\u8981\u7684\u7ebf\u7a0b\u6280\u672f\uff0c\u5b83\u4e3a\u6bcf\u4e2a\u7ebf\u7a0b\u63d0\u4f9b\u4e86\u5b83\u81ea\u5df1\u7684\u53d8\u91cf\u526f\u672c\uff0c\u4f7f\u5f97\u7ebf\u7a0b\u95f4\u65e0\u6cd5\u76f8\u4e92\u8bbf\u95ee\u5bf9\u65b9\u7684\u53d8\u91cf\uff0c\u4ece\u800c\u907f\u514d\u4e86\u7ebf\u7a0b\u95f4\u7684\u7ade\u4e89\u548c\u6570\u636e\u6cc4\u9732\u95ee\u9898\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u7279\u6027<\/strong>\uff1a<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u53d8\u91cf\u8fde\u7eed\u6027<\/strong>\uff1a\u5f53\u7ebf\u7a0b\u5207\u6362\u65f6\uff0cThreadLocal\u53ef\u4ee5\u4fdd\u6301\u53d8\u91cf\u7684\u8fde\u7eed\u6027\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">InheritableThreadLocal<\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"1399:6-1399:214\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u7ebf\u7a0b\u7ee7\u627f<\/strong>\uff1a\u5141\u8bb8\u7236\u7ebf\u7a0b\u4e2d\u7684InheritableThreadLocal\u53d8\u91cf\u7684\u503c\u88ab\u5b50\u7ebf\u7a0b\u7ee7\u627f\u3002\u5f53\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u7ebf\u7a0b\u65f6\uff0c\u8fd9\u4e2a\u65b0\u7ebf\u7a0b\u53ef\u4ee5\u8bbf\u95ee\u5176\u7236\u7ebf\u7a0b\u4e2dInheritableThreadLocal\u53d8\u91cf\u7684\u503c\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<ul data-sourcepos=\"1397:4-1401:0\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u5b9a\u4e49<\/strong>\uff1aInheritableThreadLocal\u662fThreadLocal\u7684\u4e00\u4e2a\u5b50\u7c7b\uff0c\u5b83\u5305\u542b\u4e86ThreadLocal\u7684\u6240\u6709\u529f\u80fd\uff0c\u5e76\u6269\u5c55\u4e86ThreadLocal\u7684\u529f\u80fd\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u7279\u6027<\/strong>\uff1a<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u4f7f\u7528\u573a\u666f<\/strong>\uff1a\u9002\u7528\u4e8e\u9700\u8981\u5728\u7236\u7ebf\u7a0b\u548c\u5b50\u7ebf\u7a0b\u4e4b\u95f4\u4f20\u9012\u6570\u636e\u7684\u573a\u666f\uff0c\u5982\u7ebf\u7a0b\u6c60\u4e2d\u7684\u4efb\u52a1\u4f20\u9012\u7b49\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<li style=\"margin-top: 0.25em;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">TransmittableThreadLocal<\/span><\/section>\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u603b\u7ed3\u8d77\u6765\u5982\u4e0b<\/strong>\uff1a<\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"1406:6-1408:119\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8de8\u7ebf\u7a0b\u4f20\u9012\uff1a\u80fd\u591f\u5728\u591a\u7ebf\u7a0b\u4f20\u9012\u4e2d\u4fdd\u6301\u53d8\u91cf\u7684\u4f20\u9012\u6027\uff0c\u786e\u4fdd\u5728\u7236\u7ebf\u7a0b\u548c\u5b50\u7ebf\u7a0b\u4e4b\u95f4\u6b63\u786e\u4f20\u9012ThreadLocal\u53d8\u91cf\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">copy \u65b9\u6cd5\u7528\u4e8e\u5b9a\u5236\u4efb\u52a1\u63d0\u4ea4\u7ed9\u7ebf\u7a0b\u6c60\u65f6\u7684 ThreadLocal \u503c\u4f20\u9012\u5230\u4efb\u52a1\u6267\u884c\u65f6\u7684\u62f7\u8d1d\u884c\u4e3a\uff0c\u7f3a\u7701\u4f20\u9012\u7684\u662f\u5f15\u7528\u3002\u6ce8\u610f\uff1a\u5982\u679c\u8de8\u7ebf\u7a0b\u4f20\u9012\u4e86\u5bf9\u8c61\u5f15\u7528\u56e0\u4e3a\u4e0d\u518d\u6709\u7ebf\u7a0b\u5c01\u95ed\uff0c\u4e0e InheritableThreadLocal.childValue \u4e00\u6837\uff0c\u4f7f\u7528\u8005\/\u4e1a\u52a1\u903b\u8f91\u8981\u6ce8\u610f\u4f20\u9012\u5bf9\u8c61\u7684\u7ebf\u7a0b\u5b89\u5168\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">protected \u7684 beforeExecute\/afterExecute \u65b9\u6cd5\u6267\u884c\u4efb\u52a1(Runnable\/Callable)\u7684\u524d\/\u540e\u7684\u751f\u547d\u5468\u671f\u56de\u8c03\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<ul data-sourcepos=\"1404:4-1410:3\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u5b9a\u4e49<\/strong>\uff1aTransmittableThreadLocal\u662f\u963f\u91cc\u5df4\u5df4\u5f00\u6e90\u7684\u4e00\u4e2a\u6846\u67b6\uff0c\u7528\u4e8e\u89e3\u51b3\u5728\u4f7f\u7528\u7ebf\u7a0b\u6c60\u7b49\u573a\u666f\u4e0b\uff0cThreadLocal\u53d8\u91cf\u65e0\u6cd5\u8de8\u7ebf\u7a0b\u4f20\u9012\u7684\u95ee\u9898\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u7279\u6027<\/strong>\uff1a<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u4f7f\u7528\u573a\u666f<\/strong>\uff1a\u9002\u7528\u4e8e\u9700\u8981\u5728\u7ebf\u7a0b\u6c60\u7b49\u573a\u666f\u4e0b\u8de8\u7ebf\u7a0b\u4f20\u9012ThreadLocal\u53d8\u91cf\u7684\u573a\u666f\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<\/ol>\n<blockquote data-sourcepos=\"1413:1-1415:166\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<ul data-sourcepos=\"1413:3-1415:166\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>ThreadLocal<\/strong>\u9002\u7528\u4e8e\u7ebf\u7a0b\u5185\u90e8\u7684\u6570\u636e\u5b58\u50a8\u548c\u8bbf\u95ee\uff0c\u786e\u4fdd\u6570\u636e\u5728\u7ebf\u7a0b\u95f4\u7684\u9694\u79bb\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>InheritableThreadLocal<\/strong>\u9002\u7528\u4e8e\u9700\u8981\u5728\u7236\u7ebf\u7a0b\u548c\u5b50\u7ebf\u7a0b\u95f4\u4f20\u9012\u6570\u636e\u7684\u573a\u666f\uff0c\u5b9e\u73b0\u6570\u636e\u7684\u7ee7\u627f\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>TransmittableThreadLocal<\/strong>\u5219\u662f\u4e3a\u4e86\u89e3\u51b3\u5728\u4f7f\u7528\u7ebf\u7a0b\u6c60\u7b49\u573a\u666f\u4e0b\uff0cThreadLocal\u53d8\u91cf\u65e0\u6cd5\u8de8\u7ebf\u7a0b\u4f20\u9012\u7684\u95ee\u9898\uff0c\u5b9e\u73b0\u6570\u636e\u7684\u8de8\u7ebf\u7a0b\u4f20\u9012\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<\/blockquote>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728\u9009\u62e9\u4f7f\u7528\u54ea\u4e2a\u7c7b\u65f6\uff0c\u5e94\u6839\u636e\u5177\u4f53\u7684\u4e1a\u52a1\u573a\u666f\u548c\u9700\u6c42\u8fdb\u884c\u6743\u8861\u3002\u540c\u65f6\uff0c\u4e5f\u9700\u8981\u6ce8\u610f\u5728\u4f7f\u7528\u5b8c\u8fd9\u4e9b\u7c7b\u540e\uff0c\u53ca\u65f6\u6e05\u7406\u4e0d\u518d\u9700\u8981\u7684\u6570\u636e\uff0c\u907f\u514d\u5185\u5b58\u6cc4\u6f0f\u3002<\/span><\/section>\n<h3 data-sourcepos=\"1419:1-1419:45\" style=\"letter-spacing: normal;text-align: start;white-space: normal;margin-top: 14px;margin-bottom: 16px;font-size: 1.25em;font-weight: 600;padding-top: 10px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u548csynchronized\u4e4b\u95f4\u7684\u6bd4\u8f83<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u548csynchronized\u5728Java\u4e2d\u90fd\u662f\u7528\u4e8e\u5904\u7406\u591a\u7ebf\u7a0b\u95ee\u9898\u7684\u673a\u5236\uff0c\u4f46\u5b83\u4eec\u4e4b\u95f4\u5b58\u5728\u4e00\u4e9b\u5173\u952e\u7684\u533a\u522b\u3002<\/span><\/section>\n<ol data-sourcepos=\"1423:1-1439:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6838\u5fc3\u601d\u60f3<\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"1425:4-1427:0\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>ThreadLocal<\/strong>\uff1a\u5176\u6838\u5fc3\u601d\u60f3\u662f\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u3002\u5b83\u4e3a\u6bcf\u4e2a\u7ebf\u7a0b\u63d0\u4f9b\u4e86\u4e00\u4e2a\u72ec\u7acb\u7684\u53d8\u91cf\u526f\u672c\uff0c\u4f7f\u5f97\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u53ef\u4ee5\u8bbf\u95ee\u548c\u4fee\u6539\u81ea\u5df1\u7684\u53d8\u91cf\u526f\u672c\uff0c\u800c\u4e0d\u4f1a\u5f71\u54cd\u5230\u5176\u4ed6\u7ebf\u7a0b\u3002\u7531\u4e8e\u6bcf\u4e2a\u7ebf\u7a0b\u64cd\u4f5c\u7684\u662f\u81ea\u5df1\u7684\u53d8\u91cf\u526f\u672c\uff0c\u56e0\u6b64\u591a\u4e2a\u7ebf\u7a0b\u53ef\u4ee5\u540c\u65f6\u8bbf\u95ee\u8be5\u53d8\u91cf\uff0c\u4e14\u76f8\u4e92\u4e4b\u95f4\u4e0d\u4f1a\u4ea7\u751f\u5f71\u54cd\u3002\u8fd9\u79cd\u673a\u5236\u4e3b\u8981\u7528\u4e8e\u4fdd\u5b58\u7ebf\u7a0b\u79c1\u6709\u6570\u636e\u3001\u63d0\u9ad8\u6027\u80fd\u3001\u7ba1\u7406\u7ebf\u7a0b\u7279\u5b9a\u7684\u8d44\u6e90\u7b49\u573a\u666f\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>synchronized<\/strong>\uff1a\u5176\u6838\u5fc3\u601d\u60f3\u662f\u4ee5\u65f6\u95f4\u6362\u7a7a\u95f4\u3002\u5b83\u786e\u4fdd\u540c\u4e00\u65f6\u523b\u53ea\u6709\u4e00\u4e2a\u7ebf\u7a0b\u80fd\u591f\u6267\u884c\u88absynchronized\u4fee\u9970\u7684\u4ee3\u7801\u5757\u6216\u65b9\u6cd5\uff0c\u5176\u4ed6\u7ebf\u7a0b\u5fc5\u987b\u7b49\u5f85\u9501\u7684\u91ca\u653e\u3002\u591a\u4e2a\u7ebf\u7a0b\u8bbf\u95ee\u7684\u662f\u540c\u4e00\u4e2a\u53d8\u91cf\uff0c\u5f53\u591a\u4e2a\u7ebf\u7a0b\u540c\u65f6\u8bbf\u95ee\u8be5\u53d8\u91cf\u65f6\uff0c\u9700\u8981\u62a2\u5360\u9501\uff0c\u5e76\u4e14\u7b49\u5f85\u83b7\u53d6\u9501\u7684\u7ebf\u7a0b\u91ca\u653e\u9501\uff0c\u56e0\u6b64\u4f1a\u6d88\u8017\u8f83\u591a\u7684\u65f6\u95f4\u3002synchronized\u4e3b\u8981\u7528\u4e8e\u4fdd\u62a4\u5171\u4eab\u8d44\u6e90\uff0c\u9632\u6b62\u7ade\u6001\u6761\u4ef6\u548c\u6570\u636e\u4e0d\u4e00\u81f4\u95ee\u9898\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5e94\u7528\u573a\u666f<\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"1430:4-1432:0\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>ThreadLocal<\/strong>\u4e3b\u8981\u7528\u4e8e\u7ebf\u7a0b\u95f4\u7684\u6570\u636e\u9694\u79bb\uff0c\u5e38\u89c1\u5e94\u7528\u573a\u666f\u5305\u62ec\u7ebf\u7a0b\u5c01\u95ed\uff08\u5c06\u5bf9\u8c61\u5c01\u95ed\u5728\u5355\u4e2a\u7ebf\u7a0b\u4e2d\uff0c\u907f\u514d\u7ebf\u7a0b\u5b89\u5168\u95ee\u9898\uff09\u3001\u4fdd\u5b58\u7ebf\u7a0b\u4e0a\u4e0b\u6587\u4fe1\u606f\uff08\u5982\u5728Web\u5f00\u53d1\u4e2d\u5b58\u50a8\u7528\u6237\u4fe1\u606f\u548c\u8bf7\u6c42\u53c2\u6570\uff09\u3001\u6570\u636e\u5e93\u8fde\u63a5\u7ba1\u7406\uff08\u786e\u4fdd\u6bcf\u4e2a\u7ebf\u7a0b\u83b7\u53d6\u5230\u81ea\u5df1\u7684\u6570\u636e\u5e93\u8fde\u63a5\uff09\u4ee5\u53ca\u7ebf\u7a0b\u6c60\u4e2d\u7684\u4efb\u52a1\u9694\u79bb\u7b49\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>Synchronized<\/strong>\u4e3b\u8981\u7528\u4e8e\u7ebf\u7a0b\u95f4\u7684\u6570\u636e\u5171\u4eab\uff0c\u5e38\u7528\u4e8e\u4fdd\u62a4\u5171\u4eab\u8d44\u6e90\uff0c\u5982\u5171\u4eab\u6570\u636e\u6216\u5bf9\u8c61\uff0c\u786e\u4fdd\u540c\u4e00\u65f6\u95f4\u53ea\u6709\u4e00\u4e2a\u7ebf\u7a0b\u8bbf\u95ee\u8fd9\u4e9b\u8d44\u6e90\u3002\u6b64\u5916\uff0c\u5b83\u8fd8\u53ef\u4ee5\u7528\u4e8e\u4fdd\u62a4\u9700\u8981\u539f\u5b50\u6027\u6267\u884c\u7684\u4ee3\u7801\u5757\uff0c\u9632\u6b62\u591a\u7ebf\u7a0b\u5e76\u53d1\u6267\u884c\u5bfc\u81f4\u7684\u95ee\u9898\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<li style=\"margin-top: 0.25em;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6027\u80fd\u548c\u8d44\u6e90\u6d88\u8017<\/span><\/section>\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u7efc\u4e0a\u6240\u8ff0<\/strong>\uff1a<\/span><\/section>\n<\/li>\n<ul data-sourcepos=\"1435:4-1437:3\" style=\"padding-left: 2em;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>ThreadLocal<\/strong>\u4e3a\u6bcf\u4e2a\u7ebf\u7a0b\u521b\u5efa\u53d8\u91cf\u526f\u672c\uff0c\u56e0\u6b64\u4f1a\u6d88\u8017\u8f83\u591a\u7684\u5185\u5b58\u3002\u4f46\u7531\u4e8e\u7ebf\u7a0b\u95f4\u4e92\u4e0d\u5e72\u6270\uff0c\u6240\u4ee5\u5e76\u53d1\u6027\u80fd\u8f83\u9ad8\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>synchronized<\/strong>\u5219\u901a\u8fc7\u9501\u673a\u5236\u6765\u63a7\u5236\u7ebf\u7a0b\u5bf9\u5171\u4eab\u8d44\u6e90\u7684\u8bbf\u95ee\uff0c\u867d\u7136\u8282\u7701\u4e86\u5185\u5b58\u7a7a\u95f4\uff0c\u4f46\u5728\u591a\u7ebf\u7a0b\u73af\u5883\u4e0b\u53ef\u80fd\u4f1a\u56e0\u4e3a\u9501\u7ade\u4e89\u800c\u964d\u4f4e\u6027\u80fd\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<\/ol>\n<blockquote data-sourcepos=\"1440:1-1440:211\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal\u548csynchronized\u5728\u89e3\u51b3\u591a\u7ebf\u7a0b\u8bbf\u95ee\u76f8\u540c\u53d8\u91cf\u7684\u51b2\u7a81\u95ee\u9898\u4e0a\u5404\u6709\u5176\u7279\u70b9\u548c\u9002\u7528\u573a\u666f\u3002\u9009\u62e9\u4f7f\u7528\u54ea\u79cd\u673a\u5236\u5e94\u6839\u636e\u5177\u4f53\u7684\u4e1a\u52a1\u9700\u6c42\u3001\u6027\u80fd\u8981\u6c42\u548c\u8d44\u6e90\u9650\u5236\u6765\u51b3\u5b9a\u3002<\/span><\/section>\n<\/blockquote>\n<h2 data-sourcepos=\"1444:1-1444:43\" style=\"font-weight: bold;font-size: 22px;margin: 10px auto 5px;border-top-width: 1px;border-top-style: solid;border-top-color: rgb(242, 242, 242);background-color: rgb(242, 242, 242);\"><span style=\"margin-top: -1px;padding-top: 14px;padding-bottom: 14px;padding-right: 5px;padding-left: 5px;font-size: 17px;border-top: 4px solid rgb(33, 33, 34);display: inline-block;line-height: 1.5;font-weight: normal;background-color: rgb(30, 30, 30);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 20px;padding-left: 10px;\">FastThreadLocal \uff08FTL\uff09\u7684\u5b9e\u73b0\u539f\u7406<\/span><\/h2>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocal<\/span><\/code><span style=\"font-size: 15px;\">\u662f\u4e00\u4e2a\u5e38\u7528\u7684\u5de5\u5177\u7c7b\uff0c\u5b83\u5141\u8bb8\u6211\u4eec\u521b\u5efa\u7ebf\u7a0b\u5c40\u90e8\u53d8\u91cf\u3002\u8fd9\u610f\u5473\u7740\u6bcf\u4e2a\u7ebf\u7a0b\u90fd\u53ef\u4ee5\u72ec\u7acb\u5730\u6539\u53d8\u81ea\u5df1\u7684\u526f\u672c\uff0c\u800c\u4e0d\u4f1a\u5f71\u54cd\u5176\u4ed6\u7ebf\u7a0b\u6240\u6301\u6709\u7684\u6570\u636e\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7136\u800c\uff0c<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocal<\/span><\/code><span style=\"font-size: 15px;\">\u5728\u9ad8\u5e76\u53d1\u73af\u5883\u4e0b\u5b58\u5728\u4e00\u4e9b\u95ee\u9898\uff1a<\/span><\/section>\n<ol data-sourcepos=\"1450:1-1452:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u5185\u5b58\u5360\u7528<\/strong>\uff1a\u6bcf\u4e2a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">ThreadLocal<\/span><\/code><span style=\"font-size: 15px;\">\u53d8\u91cf\u90fd\u4f1a\u5728\u6bcf\u4e2a\u7ebf\u7a0b\u4e2d\u6301\u6709\u4e00\u4e2a\u72ec\u7acb\u7684\u526f\u672c\uff0c\u8fd9\u53ef\u80fd\u5bfc\u81f4\u5927\u91cf\u7684\u5185\u5b58\u5360\u7528\u3002<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u6027\u80fd\u5f00\u9500<\/strong>\uff1a\u521b\u5efa\u548c\u9500\u6bc1\u8fd9\u4e9b\u7ebf\u7a0b\u5c40\u90e8\u53d8\u91cf\u4f1a\u5e26\u6765\u989d\u5916\u7684\u6027\u80fd\u5f00\u9500\u3002<\/span><\/section>\n<\/li>\n<\/ol>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">Netty \u662f\u4e00\u4e2a\u8ffd\u6c42\u6781\u81f4\u9ad8\u6027\u80fd\u7684\u7ec4\u4ef6\uff0c Netty \u7684<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">FastThreadLocal<\/span><\/code><span style=\"font-size: 15px;\">\u5c31\u662f\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e9b\u95ee\u9898\u800c\u8bde\u751f\u7684\u3002<\/span><\/section>\n<h3 data-sourcepos=\"1455:1-1455:41\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">\u4ec0\u4e48\u662fFastThreadLocal \uff08FTL\uff09\uff1f<\/span><\/h3>\n<blockquote data-sourcepos=\"1459:1-1461:108\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6587\u6863\u592a\u957f\uff0c\u8d85\u8fc7\u4e86 \u5e73\u53f0\u9650\u5236........<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u90e8\u5206\u8be6\u7ec6\u5185\u5bb9\u7565\uff0c\u8bf7\u53c2\u89c1PDF \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b<\/span><\/section>\n<\/blockquote>\n<h3 data-sourcepos=\"1465:1-1465:33\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">FastThreadLocal \u5982\u4f55\u4f7f\u7528<\/span><\/h3>\n<blockquote data-sourcepos=\"1469:1-1471:108\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6587\u6863\u592a\u957f\uff0c\u8d85\u8fc7\u4e86 \u5e73\u53f0\u9650\u5236........<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u90e8\u5206\u8be6\u7ec6\u5185\u5bb9\u7565\uff0c\u8bf7\u53c2\u89c1PDF \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b<\/span><\/section>\n<\/blockquote>\n<h3 data-sourcepos=\"1477:1-1477:29\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">FastThreadLocal \u7684\u4f18\u52bf<\/span><\/h3>\n<blockquote data-sourcepos=\"1481:1-1483:108\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6587\u6863\u592a\u957f\uff0c\u8d85\u8fc7\u4e86 \u5e73\u53f0\u9650\u5236........<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u90e8\u5206\u8be6\u7ec6\u5185\u5bb9\u7565\uff0c\u8bf7\u53c2\u89c1PDF \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b<\/span><\/section>\n<\/blockquote>\n<h3 data-sourcepos=\"1487:1-1487:32\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">FastThreadLocal \u4e3a\u4ec0\u4e48\u5feb<\/span><\/h3>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">FastThreadLocal \u7684\u5b9e\u73b0\u4e0e ThreadLocal \u975e\u5e38\u7c7b\u4f3c\uff0cNetty \u4e3a FastThreadLocal \u91cf\u8eab\u6253\u9020\u4e86 FastThreadLocalThread \u548c InternalThreadLocalMap \u4e24\u4e2a\u91cd\u8981\u7684\u7c7b\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e0b\u9762\u6211\u4eec\u770b\u4e0b\u8fd9\u4e24\u4e2a\u7c7b\u662f\u5982\u4f55\u5b9e\u73b0\u7684\u3002 FastThreadLocalThread \u662f\u5bf9 Thread \u7c7b\u7684\u4e00\u5c42\u5305\u88c5\uff0c\u6bcf\u4e2a\u7ebf\u7a0b\u5bf9\u5e94\u4e00\u4e2a InternalThreadLocalMap \u5b9e \u4f8b\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u53ea\u6709 FastThreadLocal \u548c FastThreadLocalThread \u7ec4\u5408\u4f7f\u7528\u65f6\uff0c\u624d\u80fd\u53d1\u6325 FastThreadLocal \u7684\u6027 \u80fd\u4f18\u52bf\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u9996\u5148\u770b\u4e0b FastThreadLocalThread \u7684\u6e90\u7801\u5b9a\u4e49\uff1a<\/span><\/section>\n<pre data-sourcepos=\"1503:1-1508:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">class<\/span> <span style=\"color: rgb(183, 85, 1);\">FastThreadLocalThread<\/span> <span style=\"color: rgb(1, 86, 146);\">extends<\/span> <span style=\"color: rgb(183, 85, 1);\">Thread<\/span> {<span style=\"color: rgb(1, 86, 146);\">private<\/span> InternalThreadLocalMap threadLocalMap;<span style=\"color: rgb(101, 110, 119);\">\/\/ \u7701\u7565\u5176\u4ed6\u4ee3\u7801<\/span>}<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u53ef\u4ee5\u770b\u51fa FastThreadLocalThread \u4e3b\u8981\u6269\u5c55\u4e86 InternalThreadLocalMap \u5b57\u6bb5\uff0c<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">FastThreadLocalThread \u4e3b\u8981\u4f7f\u7528 InternalThreadLocalMap \u5b58\u50a8\u6570\u636e<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6ce8\u610f\uff0c FastThreadLocalThread \u4e0d\u518d\u662f\u4f7f\u7528 Thread \u4e2d\u7684ThreadLocalMap\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6240\u4ee5\u60f3\u77e5\u9053 FastThreadLocalThread \u9ad8\u6027\u80fd\u7684\u5965\u79d8\uff0c\u5fc5\u987b\u8981\u4e86\u89e3InternalThreadLocalMap \u7684\u8bbe\u8ba1\u539f\u7406\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4e0a\u6587\u4e2d\u6211\u4eec\u8bb2\u5230\u4e86 ThreadLocal \u7684\u4e00\u4e2a\u91cd\u8981\u7f3a\u70b9\uff0c\u5c31\u662f ThreadLocalMap \u91c7\u7528\u7ebf\u6027\u63a2\u6d4b\u6cd5\u89e3\u51b3 Hash\u51b2\u7a81\u6027\u80fd\u8f83\u6162\uff0c\u90a3\u4e48 InternalThreadLocalMap \u53c8\u662f\u5982\u4f55\u4f18\u5316\u7684\u5462\uff1f<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u9996\u5148\u4e00\u8d77\u770b\u4e0b InternalThreadLocalMap \u7684\u5185\u90e8\u6784\u9020\u3002<\/span><\/section>\n<pre data-sourcepos=\"1526:1-1584:3\" style=\"letter-spacing: normal;text-align: start;font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;margin-bottom: 16px;overflow-wrap: normal;overflow: auto;line-height: 1.45;border-radius: 4px;border-width: thin;border-style: solid;border-color: rgb(224, 224, 224);caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);\"><section style=\"display: block;overflow-x: auto;padding: 16px;color: rgb(47, 51, 55);background-color: rgb(246, 246, 246);font-family: Menlo, ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Courier, &quot;Courier New&quot;, Monaco, monospace, system-ui, ui-serif, ui-rounded;word-break: normal;border-radius: 3px;word-wrap: normal;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> <span style=\"color: rgb(1, 86, 146);\">class<\/span> <span style=\"color: rgb(183, 85, 1);\">InternalThreadLocalMap<\/span> <span style=\"color: rgb(1, 86, 146);\">extends<\/span> <span style=\"color: rgb(183, 85, 1);\">UnpaddedInternalThreadLocalMap<\/span> {    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> InternalLogger logger = InternalLoggerFactory.getInstance(InternalThreadLocalMap.<span style=\"color: rgb(1, 86, 146);\">class<\/span>);    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> ThreadLocal&lt;InternalThreadLocalMap&gt; slowThreadLocalMap =            <span style=\"color: rgb(1, 86, 146);\">new<\/span> ThreadLocal&lt;InternalThreadLocalMap&gt;();    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> AtomicInteger nextIndex = <span style=\"color: rgb(1, 86, 146);\">new<\/span> AtomicInteger();    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> <span style=\"color: rgb(1, 86, 146);\">int<\/span> DEFAULT_ARRAY_LIST_INITIAL_CAPACITY = <span style=\"color: rgb(183, 85, 1);\">8<\/span>;    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> <span style=\"color: rgb(1, 86, 146);\">int<\/span> ARRAY_LIST_CAPACITY_EXPAND_THRESHOLD = <span style=\"color: rgb(183, 85, 1);\">1<\/span> &lt;&lt; <span style=\"color: rgb(183, 85, 1);\">30<\/span>;    <span style=\"color: rgb(101, 110, 119);\">\/\/ Reference: https:\/\/hg.openjdk.java.net\/jdk8\/jdk8\/jdk\/file\/tip\/src\/share\/classes\/java\/util\/ArrayList.java#l229<\/span>    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> <span style=\"color: rgb(1, 86, 146);\">int<\/span> ARRAY_LIST_CAPACITY_MAX_SIZE = Integer.MAX_VALUE - <span style=\"color: rgb(183, 85, 1);\">8<\/span>;    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> <span style=\"color: rgb(1, 86, 146);\">int<\/span> STRING_BUILDER_INITIAL_SIZE;    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> <span style=\"color: rgb(1, 86, 146);\">int<\/span> STRING_BUILDER_MAX_SIZE;    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> <span style=\"color: rgb(1, 86, 146);\">int<\/span> HANDLER_SHARABLE_CACHE_INITIAL_CAPACITY = <span style=\"color: rgb(183, 85, 1);\">4<\/span>;    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> <span style=\"color: rgb(1, 86, 146);\">int<\/span> INDEXED_VARIABLE_TABLE_INITIAL_SIZE = <span style=\"color: rgb(183, 85, 1);\">32<\/span>;    <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">static<\/span> <span style=\"color: rgb(1, 86, 146);\">final<\/span> Object UNSET = <span style=\"color: rgb(1, 86, 146);\">new<\/span> Object();    <span style=\"color: rgb(101, 110, 119);\">\/** Used by {<span style=\"color: rgb(1, 86, 146);\">@link<\/span> FastThreadLocal} *\/<\/span>    <span style=\"color: rgb(1, 86, 146);\">private<\/span> Object[] indexedVariables;    <span style=\"color: rgb(101, 110, 119);\">\/\/ Core thread-locals<\/span>    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">int<\/span> futureListenerStackDepth;    <span style=\"color: rgb(1, 86, 146);\">private<\/span> <span style=\"color: rgb(1, 86, 146);\">int<\/span> localChannelReaderStackDepth;    <span style=\"color: rgb(1, 86, 146);\">private<\/span> Map&lt;Class&lt;?&gt;, Boolean&gt; handlerSharableCache;    <span style=\"color: rgb(1, 86, 146);\">private<\/span> IntegerHolder counterHashCode;    <span style=\"color: rgb(1, 86, 146);\">private<\/span> ThreadLocalRandom random;    <span style=\"color: rgb(1, 86, 146);\">private<\/span> Map&lt;Class&lt;?&gt;, TypeParameterMatcher&gt; typeParameterMatcherGetCache;    <span style=\"color: rgb(1, 86, 146);\">private<\/span> Map&lt;Class&lt;?&gt;, Map&lt;String, TypeParameterMatcher&gt;&gt; typeParameterMatcherFindCache;    <span style=\"color: rgb(101, 110, 119);\">\/\/ String-related thread-locals<\/span>    <span style=\"color: rgb(1, 86, 146);\">private<\/span> StringBuilder stringBuilder;    <span style=\"color: rgb(1, 86, 146);\">private<\/span> Map&lt;Charset, CharsetEncoder&gt; charsetEncoderCache;    <span style=\"color: rgb(1, 86, 146);\">private<\/span> Map&lt;Charset, CharsetDecoder&gt; charsetDecoderCache;    <span style=\"color: rgb(101, 110, 119);\">\/\/ ArrayList-related thread-locals<\/span>    <span style=\"color: rgb(1, 86, 146);\">private<\/span> ArrayList&lt;Object&gt; arrayList;    <span style=\"color: rgb(1, 86, 146);\">private<\/span> BitSet cleanerFlags;    <span style=\"color: rgb(101, 110, 119);\">\/** <span style=\"color: rgb(1, 86, 146);\">@deprecated<\/span> These padding fields will be removed in the future. *\/<\/span>    <span style=\"color: rgb(1, 86, 146);\">public<\/span> <span style=\"color: rgb(1, 86, 146);\">long<\/span> rp1, rp2, rp3, rp4, rp5, rp6, rp7, rp8;    <span style=\"color: rgb(1, 86, 146);\">static<\/span> {        STRING_BUILDER_INITIAL_SIZE =                SystemPropertyUtil.getInt(<span style=\"color: rgb(84, 121, 13);\">\"io.netty.threadLocalMap.stringBuilder.initialSize\"<\/span>, <span style=\"color: rgb(183, 85, 1);\">1024<\/span>);        logger.debug(<span style=\"color: rgb(84, 121, 13);\">\"-Dio.netty.threadLocalMap.stringBuilder.initialSize: {}\"<\/span>, STRING_BUILDER_INITIAL_SIZE);        STRING_BUILDER_MAX_SIZE = SystemPropertyUtil.getInt(<span style=\"color: rgb(84, 121, 13);\">\"io.netty.threadLocalMap.stringBuilder.maxSize\"<\/span>, <span style=\"color: rgb(183, 85, 1);\">1024<\/span> * <span style=\"color: rgb(183, 85, 1);\">4<\/span>);        logger.debug(<span style=\"color: rgb(84, 121, 13);\">\"-Dio.netty.threadLocalMap.stringBuilder.maxSize: {}\"<\/span>, STRING_BUILDER_MAX_SIZE);    }<span style=\"color: rgb(101, 110, 119);\">\/\/ \u7701\u7565\u5176\u4ed6\u4ee3\u7801<\/span>}<\/span><\/section><\/pre>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4ece InternalThreadLocalMap \u5185\u90e8\u5b9e\u73b0\u6765\u770b\uff0c\u4e0e ThreadLocalMap \u4e00\u6837\u90fd\u662f\u91c7\u7528<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u6570\u7ec4<\/span><\/code><span style=\"font-size: 15px;\">\u7684\u5b58\u50a8\u65b9\u5f0f\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4f46\u662fInternalThreadLocalMap \u5e76\u6ca1\u6709\u4f7f\u7528\u7ebf\u6027\u63a2\u6d4b\u6cd5\u6765\u89e3\u51b3 Hash \u51b2\u7a81\uff0c\u800c\u662f\u53e6\u8f9f\u8e4a\u5f84\uff0c\u4f7f\u7528\u6570\u7ec4\u66ff\u4ee3map\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7b80\u5355\u6765\u8bf4\uff0c\u800c\u662f\u5728 FastThreadLocal \u521d\u59cb\u5316 \u7684\u65f6\u5019\uff0c\u4e3a\u6bcf\u4e00\u4e2a\u672c\u5730\u53d8\u91cf\uff0c\u5206\u914d\u4e00\u4e2a<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">\u5168\u5c40\u552f\u4e00\u7684\u7d22\u5f15 index<\/span><\/code><span style=\"font-size: 15px;\">\uff0c\u6570\u7ec4\u7d22\u5f15 index \u7684\u503c\u91c7\u7528\u539f\u5b50\u7c7b<\/span><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\"><span style=\"font-size: 15px;\">AtomicInteger<\/span><\/code><span style=\"font-size: 15px;\">\u4fdd\u8bc1\u987a\u5e8f\u9012\u589e\uff0c<\/span><\/section>\n<ul data-sourcepos=\"1592:1-1595:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u6bcf\u4e00\u4e2a\u672c\u5730\u53d8\u91cf\uff0c\u5206\u914d\u4e00\u4e2a<\/strong><strong><code style=\"font-family: ui-monospace, SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace;font-size: 13.6px;padding: 0.14em 0.3em;vertical-align: 5%;background-color: rgba(27, 31, 35, 0.05);border-radius: 3px;border-width: 1px;border-style: solid;border-color: rgb(223, 226, 229);\">\u5168\u5c40\u552f\u4e00\u7684\u7d22\u5f15 index<\/code>.<\/strong><\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\"><strong>\u8fd9\u4e2a\u6570\u7ec4\u7d22\u5f15 index \u7684\u503c \u548c\u672c\u5730\u53d8\u91cf\u7ed1\u5b9a\uff0c \u901a\u8fc7\u8c03\u7528InternalThreadLocalMap.nextVariableIndex() \u65b9\u6cd5\u83b7\u5f97\u3002<\/strong><\/span><\/section>\n<\/li>\n<\/ul>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7136\u540e\u5728\u8bfb\u5199\u6570\u636e\u7684\u65f6\u5019\u901a\u8fc7\u6570\u7ec4\u4e0b\u6807index\u76f4\u63a5\u5b9a\u4f4d\u5230 FastThreadLocal \u7684\u4f4d\u7f6e\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(1)\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u548c \u666e\u901a\u7684ThreadLocalMap \u76f8\u6bd4\uff0c InternalThreadLocalMap \u7684 \u5927\u81f4\u5185\u90e8\u7ed3\u6784\uff0c\u5982\u4e0b\uff1a<\/span><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018222\" data-ratio=\"0.6794310722100656\" data-s=\"300,640\"  data-type=\"png\" data-w=\"914\" style=\"text-align: center;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142921649.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018222\" data-ratio=\"0.6794310722100656\" data-s=\"300,640\"  data-type=\"png\" data-w=\"914\" style=\"text-align: center;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142921649.png\"  \/><\/noscript><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5047\u8bbe\u73b0\u5728\u6211\u4eec\u6709\u4e00\u6279\u6570\u636e\u9700\u8981\u6dfb\u52a0\u5230\u6570\u7ec4\u4e2d\uff0c\u5206\u522b\u4e3a value1\u3001value2\u3001value3\u3001value4\uff0c\u5bf9\u5e94\u7684 FastThreadLocal \u5728\u521d\u59cb\u5316\u7684\u65f6\u5019\u751f\u6210\u7684\u6570\u7ec4\u7d22\u5f15\u5206\u522b\u4e3a 1\u30012\u30013\u30014\u3002\u5982\u4e0b\u56fe\u6240\u793a\uff1a<\/span><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-galleryid=\"\" data-imgfileid=\"100018223\" data-ratio=\"0.4959266802443992\" data-s=\"300,640\"  data-type=\"png\" data-w=\"982\" style=\"text-align: center;\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142924664.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-galleryid=\"\" data-imgfileid=\"100018223\" data-ratio=\"0.4959266802443992\" data-s=\"300,640\"  data-type=\"png\" data-w=\"982\" style=\"text-align: center;\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142924664.png\"  \/><\/noscript><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5982\u679c\u6570\u7ec4\u4e0b\u6807\u9012\u589e\u5230\u975e\u5e38\u5927\uff0c\u90a3\u4e48\u6570\u7ec4\u4e5f\u4f1a\u6bd4\u8f83\u5927\uff0c\u6240\u4ee5 FastThreadLocal \u662f\u901a\u8fc7\u7a7a\u95f4\u6362\u65f6\u95f4\u7684\u601d\u60f3\u63d0\u5347\u8bfb\u5199\u6027\u80fd\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5b8c\u6574\u7684 FastThreadLocal\u7ed3\u6784\u5206\u6790\uff0c\u4e0b\u9762\u901a\u8fc7\u4e00\u5e45\u5177\u4f53\u7684\u56fe\uff0c\u63cf\u8ff0InternalThreadLocalMap\u3001index \u548c FastThreadLocal \u4e4b\u95f4\u7684\u5173\u7cfb\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><img decoding=\"async\" class=\"rich_pages wxw-img lazyload\" data-imgfileid=\"100018207\" data-ratio=\"0.5685185185185185\"  data-type=\"png\" data-w=\"1080\" style=\"box-sizing: content-box;border-style: none;background-color: rgb(255, 255, 255);\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142926476.png\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" class=\"rich_pages wxw-img\" data-imgfileid=\"100018207\" data-ratio=\"0.5685185185185185\"  data-type=\"png\" data-w=\"1080\" style=\"box-sizing: content-box;border-style: none;background-color: rgb(255, 255, 255);\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142926476.png\"  \/><\/noscript><\/section>\n<ol data-sourcepos=\"1619:1-1625:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">InternalThreadLocalMap\u4e2d\u5e76\u4e0d\u662fEntry\u7684key-value\u7ed3\u6784, \u800c\u662fObject\u6570\u7ec4<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u7d22\u5f150\u4f4d\u7f6e\u5b58\u653eFastThreadLocal\u7684Set\u96c6\u5408, \u5176\u4ed6\u7d22\u5f15\u4f4d\u7f6e\u521d\u59cb\u5316\u4e3aUNSET, \u6570\u636e\u5b58\u5165\u7684\u65f6\u5019\u66f4\u65b0\u4e3a\u5177\u4f53\u7684Object<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">FastThreadLocal\u4e2d\u5305\u542b\u4e00\u4e2a\u81ea\u589e\u7684index\u8868\u793a\u5728InternalThreadLocalMap\u7684\u6570\u7ec4\u4e2d\u7684\u7d22\u5f15\u4f4d\u7f6e<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">Set&lt;FastThreadLocal&lt;?&gt;&gt;\u7ed3\u6784\u4e2d\u5b58\u653eFastThreadLocal\u7684\u5f15\u7528, \u66f4\u5bb9\u6613\u89e3\u51b3\u5185\u5b58\u6cc4\u6f0f\u7684\u95ee\u9898<\/span><\/section>\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u901a\u8fc7\u4e0a\u9762 FastThreadLocal \u7684\u5185\u90e8\u7ed3\u6784\u56fe\uff0c\u6211\u4eec\u5bf9\u6bd4\u4e0b\u4e0e ThreadLocal \u6709\u54ea\u4e9b\u533a\u522b\uff1f<\/span><\/section>\n<\/li>\n<\/ol>\n<ul data-sourcepos=\"1626:1-1633:0\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;padding-left: 2em;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\" class=\"list-paddingleft-1\">\n<li style=\"font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">FastThreadLocal \u4f7f\u7528 Object \u6570\u7ec4\u66ff\u4ee3\u4e86 Entry \u6570\u7ec4\uff0c<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">Object[0] \u5b58\u50a8\u7684\u662f\u4e00\u4e2aSet\u96c6\u5408\uff0c<\/span><\/section>\n<\/li>\n<li style=\"margin-top: 0.25em;font-size: 15px;\">\n<section style=\"margin-top: 16px;margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4ece\u6570\u7ec4\u4e0b\u6807 1 \u5f00\u59cb\u90fd\u662f\u76f4\u63a5\u5b58\u50a8\u7684 value \u6570\u636e\uff0c\u4e0d\u518d\u91c7\u7528ThreadLocal \u7684\u952e\u503c\u5bf9\u5f62\u5f0f\u8fdb\u884c\u5b58\u50a8\u3002<\/span><\/section>\n<\/li>\n<\/ul>\n<h3 data-sourcepos=\"1634:1-1634:32\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">FastThreadLocal \u6e90\u7801\u5206\u6790<\/span><\/h3>\n<blockquote data-sourcepos=\"1638:1-1640:108\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6587\u6863\u592a\u957f\uff0c\u8d85\u8fc7\u4e86 \u5e73\u53f0\u9650\u5236........<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u90e8\u5206\u8be6\u7ec6\u5185\u5bb9\u7565\uff0c\u8bf7\u53c2\u89c1PDF \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b<\/span><\/section>\n<\/blockquote>\n<h4 data-sourcepos=\"1644:1-1644:36\" style=\"margin: 10px auto -1px;padding-left: 3px;font-weight: bold;font-size: 18px;white-space: normal;border-left-width: 10px;border-left-style: solid;border-left-color: rgb(222, 235, 255);\"><span style=\"margin-top: -1px;padding-top: 6px;padding-right: 5px;padding-left: 5px;font-size: 16px;display: inline-block;line-height: 1.1;\">FastThreadLocal \u7684\u56de\u6536\u673a\u5236<\/span><\/h4>\n<blockquote data-sourcepos=\"1648:1-1650:108\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6587\u6863\u592a\u957f\uff0c\u8d85\u8fc7\u4e86 \u5e73\u53f0\u9650\u5236........<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u90e8\u5206\u8be6\u7ec6\u5185\u5bb9\u7565\uff0c\u8bf7\u53c2\u89c1PDF \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b<\/span><\/section>\n<\/blockquote>\n<h4 data-sourcepos=\"1654:1-1654:41\" style=\"margin: 10px auto -1px;padding-left: 3px;font-weight: bold;font-size: 18px;white-space: normal;border-left-width: 10px;border-left-style: solid;border-left-color: rgb(222, 235, 255);\"><span style=\"margin-top: -1px;padding-top: 6px;padding-right: 5px;padding-left: 5px;font-size: 16px;display: inline-block;line-height: 1.1;\">FastThreadLocal \u5728Netty\u4e2d\u7684\u5e94\u7528<\/span><\/h4>\n<blockquote data-sourcepos=\"1658:1-1660:108\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6587\u6863\u592a\u957f\uff0c\u8d85\u8fc7\u4e86 \u5e73\u53f0\u9650\u5236........<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u90e8\u5206\u8be6\u7ec6\u5185\u5bb9\u7565\uff0c\u8bf7\u53c2\u89c1PDF \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b<\/span><\/section>\n<\/blockquote>\n<h3 data-sourcepos=\"1664:1-1664:57\" style=\"margin: 10px auto 5px;font-weight: bold;font-size: 20px;white-space: normal;background-color: rgb(252, 252, 252);\"><span style=\"margin-top: -1px;padding: 6px 20px 6px 10px;font-size: 17px;font-weight: normal;display: inline-block;line-height: 1.3;background-color: rgb(212, 224, 250);border-bottom-right-radius: 100px;color: rgb(30, 30, 30);\">\u548cThreadLocal\u76f8\u6bd4\uff0c FastThreadLocal \u7684\u4f18\u52bf\uff1a<\/span><\/h3>\n<blockquote data-sourcepos=\"1670:1-1672:108\" style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-top: 0px;margin-bottom: 16px;color: rgb(106, 115, 125);border-left-width: 0.25em;border-left-color: rgb(223, 226, 229);background-color: rgb(249, 249, 249);padding-top: 0.5em;padding-right: 10px;padding-bottom: 0.5em;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;\">\n<section style=\"margin-bottom: 16px;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u6587\u6863\u592a\u957f\uff0c\u8d85\u8fc7\u4e86 \u5e73\u53f0\u9650\u5236........<\/span><\/section>\n<section style=\"line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u8fd9\u90e8\u5206\u8be6\u7ec6\u5185\u5bb9\u7565\uff0c\u8bf7\u53c2\u89c1PDF \u300aThreadLocal \u5b66\u4e60\u5723\u7ecf\uff1a\u4e00\u6b21\u7a7f\u900fTL\u3001ITL\u3001TTL\u3001FTL\u300b<\/span><\/section>\n<\/blockquote>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 22px;margin: 10px auto 5px;border-top: 1px solid rgb(242, 242, 242);background-color: rgb(242, 242, 242);\"><span style=\"margin-top: -1px;padding-top: 14px;padding-bottom: 14px;padding-right: 5px;padding-left: 5px;font-size: 17px;border-top: 4px solid rgb(33, 33, 34);display: inline-block;line-height: 1.5;font-weight: normal;background-color: rgb(30, 30, 30);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 20px;padding-left: 10px;\">\u8bf4\u5728\u6700\u540e\uff1a\u6709\u95ee\u9898\u627e\u8001\u67b6\u6784\u53d6\u7ecf<\/span><\/h2>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">ThreadLocal \u76f8\u5173\u7684\u9762\u8bd5\u9898( \u5982\u5185\u5b58\u6cc4\u9732)\uff0c\u662f\u975e\u5e38\u5e38\u89c1\u7684\u9762\u8bd5\u9898\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u4ee5\u4e0a\u7684\u5185\u5bb9\uff0c\u5982\u679c\u5927\u5bb6\u80fd\u5bf9\u7b54\u5982\u6d41\uff0c\u5982\u6570\u5bb6\u73cd\uff0c\u57fa\u672c\u4e0a \u9762\u8bd5\u5b98\u4f1a\u88ab\u4f60 \u9707\u60ca\u5230\u3001\u5438\u5f15\u5230\u3002\u6700\u7ec8\uff0c<strong>\u8ba9\u9762\u8bd5\u5b98\u7231\u5230 \u201c\u4e0d\u80fd\u81ea\u5df2\u3001\u53e3\u6c34\u76f4\u6d41\u201d<\/strong>\u3002offer\uff0c \u4e5f\u5c31\u6765\u4e86\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u5728\u9762\u8bd5\u4e4b\u524d\uff0c\u5efa\u8bae\u5927\u5bb6\u7cfb\u7edf\u5316\u7684\u5237\u4e00\u6ce2 5000\u9875\u300a<\/span><a href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzkxNzIyMTM1NQ==&amp;mid=2247484558&amp;idx=3&amp;sn=3c498b0f8e3897e899acf154ad1ac8ee&amp;chksm=c142be0af635371c06b830243517aae063e23814195df1cc75ab2123c5b3ab9cb1217cbd80e3&amp;scene=21#wechat_redirect\" style=\"color: rgb(0, 122, 255);text-decoration: underline;font-size: 15px;\" data-linktype=\"2\" target=\"_blank\"  rel=\"nofollow\" ><span style=\"font-size: 15px;\">\u5c3c\u6069Java\u9762\u8bd5\u5b9d\u5178<\/span><\/a><span style=\"font-size: 15px;\">\u300bV174\uff0c\u5728\u5237\u9898\u8fc7\u7a0b\u4e2d\uff0c\u5982\u679c\u6709\u5565\u95ee\u9898\uff0c\u5927\u5bb6\u53ef\u4ee5\u6765 \u627e 40\u5c81\u8001\u67b6\u6784\u5e08\u5c3c\u6069\u4ea4\u6d41\u3002<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;margin-bottom: 16px;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;\"><span style=\"font-size: 15px;\">\u53e6\u5916\uff0c\u5982\u679c\u6ca1\u6709\u9762\u8bd5\u673a\u4f1a\uff0c\u53ef\u4ee5\u627e\u5c3c\u6069\u6765\u5e2e\u6276\u3001\u9886\u8def\u3002\u5c3c\u6069\u5df2\u7ecf\u6307\u5bfc\u4e86\u5927\u91cf\u7684\u5c31\u4e1a\u56f0\u96be\u7684\u5c0f\u4f19\u4f34\u4e0a\u5cb8.<\/span><\/section>\n<section style=\"font-size: 16px;letter-spacing: normal;text-align: start;white-space: normal;caret-color: rgb(36, 41, 46);color: rgb(36, 41, 46);font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;, &quot;Segoe UI Symbol&quot;;line-height: 1.75em;margin-bottom: 0px !important;\"><span style=\"font-size: 15px;\">\u524d\u6bb5\u65f6\u95f4\uff0c\u5e2e\u52a9\u4e00\u4e2a40\u5c81+\u5c31\u4e1a\u56f0\u96be\u5c0f\u4f19\u4f34\u62ff\u5230\u4e86\u4e00\u4e2a<strong>\u5e74\u85aa100W<\/strong>\u7684offer\uff0c\u5c0f\u4f19\u4f34\u5b9e\u73b0\u4e86<strong>\u9006\u5929\u6539\u547d<\/strong>\u3002<\/span><\/section>\n<h2 data-tool=\"mdnice\u7f16\u8f91\u5668\" style=\"font-weight: bold;font-size: 22px;margin: 10px auto 5px;border-top: 1px solid rgb(242, 242, 242);background-color: rgb(242, 242, 242);\"><span style=\"margin-top: -1px;padding-top: 14px;padding-bottom: 14px;padding-right: 5px;padding-left: 5px;font-size: 17px;border-top: 4px solid rgb(33, 33, 34);display: inline-block;line-height: 1.5;font-weight: normal;background-color: rgb(30, 30, 30);border-bottom-right-radius: 100px;color: rgb(255, 255, 255);padding-right: 20px;padding-left: 10px;\">\u90e8\u5206\u5386\u53f2\u6848\u4f8b<\/span><\/h2>\n<ul class=\"list-paddingleft-2\" style=\"list-style-type: disc;\">\n<li style=\"outline: 0px;font-size: 15px;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247486132&amp;idx=1&amp;sn=bb949c992b3a35935bf5fca57f19e2d8&amp;chksm=97b57b3ca0c2f22aeb0e648191801aff933164dcf2b06eb4b6274df6499bffb0bba8e8169205&amp;scene=21#wechat_redirect\" textvalue=\"\u81ea\u8003\u672c\u79d19\u5e74\u7ecf\u9a8c\uff0c\u72e0\u53773\u6708\u673a\u4f1a\u7206\u8868\uff0c\u97622\u5468\u540e\u65363\u4e2aoffer \uff0c\u6ee1\u8840\u590d\u6d3b\" linktype=\"text\" imgurl=\"\" imgdata=\"null\" data-itemshowtype=\"0\" tab=\"innerlink\" data-linktype=\"2\" hasload=\"1\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;\" rel=\"noopener\" rel=\"nofollow\" ><strong style=\"outline: 0px;\"><span style=\"outline: 0px;\">\u7edd\u5730\u9022\u751f\uff1a<\/span><\/strong><span style=\"outline: 0px;\">9\u5e74\u7ecf\u9a8c<\/span><\/a><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247486132&amp;idx=1&amp;sn=bb949c992b3a35935bf5fca57f19e2d8&amp;chksm=97b57b3ca0c2f22aeb0e648191801aff933164dcf2b06eb4b6274df6499bffb0bba8e8169205&amp;scene=21#wechat_redirect\" textvalue=\"\u81ea\u8003\u672c\u79d19\u5e74\u7ecf\u9a8c\uff0c\u72e0\u53773\u6708\u673a\u4f1a\u7206\u8868\uff0c\u97622\u5468\u540e\u65363\u4e2aoffer \uff0c\u6ee1\u8840\u590d\u6d3b\" linktype=\"text\" imgurl=\"\" imgdata=\"null\" data-itemshowtype=\"0\" tab=\"innerlink\" data-linktype=\"2\" hasload=\"1\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;letter-spacing: 0.578px;\" rel=\"noopener\" rel=\"nofollow\" ><span style=\"outline: 0px;\">\u81ea\u8003<\/span><\/a><span style=\"outline: 0px;color: rgb(217, 33, 66);\">\u5c0f\u4f19\u4f34\uff0c\u8ddf\u7740\u5c3c\u6069\u72e0\u53773\u6708\u786c\u6838\u6280\u672f\uff0c\u9762\u8bd5\u673a\u4f1a\u7206\u8868\uff0c2\u5468\u540e\u65363\u4e2aoffer \uff0c\u6ee1\u8840\u590d\u6d3b<\/span><\/p>\n<\/li>\n<li style=\"outline: 0px;font-size: 15px;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247486098&amp;idx=1&amp;sn=bbc5732b071477573bfab8a259d208d3&amp;chksm=97b57b1aa0c2f20c27dd74b490b6062c9eec262a3ac25548534ff70290b172dcc51c6eafe532&amp;scene=21#wechat_redirect\" textvalue=\"35\u5c81\u88ab\u88c16\u4e2a\u6708 \u804c\u4e1a\u7edd\u671b\uff0c\u8f6c\u67b6\u6784\u6025\u6551\u4e0a\u5cb8\uff0cDDD\u548c3\u9ad8\u9879\u76ee\u592a\u91cd\u8981\u4e86\" linktype=\"text\" imgurl=\"\" imgdata=\"null\" data-itemshowtype=\"0\" tab=\"innerlink\" data-linktype=\"2\" hasload=\"1\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;\" rel=\"noopener\" rel=\"nofollow\" ><strong style=\"outline: 0px;\"><span style=\"outline: 0px;\">\u786c\u8f6c\u67b6\u6784\uff1a<\/span><\/strong><span style=\"outline: 0px;\">35\u5c81\u88ab\u88c16\u4e2a\u6708 \u804c\u4e1a\u7edd\u671b\uff0c\u8f6c\u67b6\u6784\u6025\u6551\u4e0a\u5cb8\uff0cDDD\u548c3\u9ad8\u9879\u76ee\u592a\u91cd\u8981\u4e86<\/span><\/a><\/p>\n<\/li>\n<li style=\"outline: 0px;font-size: 15px;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247486077&amp;idx=1&amp;sn=090ad8d19559c727b80e321cd70e3c32&amp;chksm=97b57bf5a0c2f2e32a982b62cfeb2db8744260d7e2d80efdf11ad7c1c5257057ea9b1f7419ec&amp;scene=21#wechat_redirect\" textvalue=\"\u9006\u5929\u6539\u547d\uff0c3\u5e74\u7ecf\u9a8c2\u672c\uff0c\u53773\u4e2a\u6708\u6da8\u85aa60%\uff0c\u8fdb\u51c6\u5927\u5382(\u5f97\u7269\u7b49)\uff0c\u5e74\u85aa36W\" linktype=\"text\" imgurl=\"\" imgdata=\"null\" data-itemshowtype=\"0\" tab=\"innerlink\" data-linktype=\"2\" hasload=\"1\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;\" rel=\"noopener\" rel=\"nofollow\" ><strong style=\"outline: 0px;\">\u9006\u5929\u6539\u547d\uff1a<\/strong>3\u5e74\u7ecf\u9a8c2\u672c\uff0c\u53773\u4e2a\u6708\u6da8\u85aa60%\uff0c\u8fdb\u51c6\u5927\u5382(\u5f97\u7269\u3001\u4e50\u4fe1\u300158\u96c6\u56e2\u7b49)\uff0c\u5e74\u85aa36W<\/a><\/p>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247486059&amp;idx=1&amp;sn=23fa04e6ea781525732f021ab1afaeeb&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u597335\u5c81CRUD\u7a0b\u5e8f\u5a9b\uff0c12\u6708\u88ab\u88c1\u540e\uff0c\u62ff30\u4e2a\u673a\u4f1a2\u4e2aoffer\u4e0a\u5cb8\uff0c\u5e74\u5e95\u5927\u88c1\u5458\u592a\u4e0d\u5bb9\u6613\u4e86<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247486028&amp;idx=1&amp;sn=cf10ecda7a986b26e0359eba7a9cfeff&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >38\u8fd8\u6709\u6551\u5417\uff1f\u6709\u300242\u5c81\u88ab\u88c12\u5e74\u5929\u5feb\u584c\u4e86\uff0c\u6025\u65511\u4e2a\u6708\u4e0a\u5cb8\uff0c\u6210\u5f00\u53d1\u7ecf\u7406offer\uff0c\u8d77\u6b7b\u56de\u751f<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247485994&amp;idx=1&amp;sn=50b95d3ae3009d395458c8740595977f&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u88ab\u88c1\u4e0d\u614c\uff0c9\u5e74\u5c0f\u4f191\u4e2a\u6708\u559c\u63d0\u5e74\u85aa60W offer\uff0c\u505a\u4e2d\u95f4\u4ef6\u67b6\u6784\uff0c\u723d\u6b6a\u4e86<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247485972&amp;idx=1&amp;sn=9f2b5059aaad70c8018b7c6c95a08994&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >12\u5e74\u5c0f\u4f19\u8f6c\u67b6\u6784\uff0c1\u5c0f\u65f6\u8715\u53d8\u6536\u5e74\u85aa55\u4e07offer\uff0c\u79d8\u8bc0\uff1aGO+Java\u53cc\u6816\u67b6\u6784<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a target=\"_blank\" href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247485942&amp;idx=1&amp;sn=faa999fc9508435db7a88af2716492d9&amp;chksm=97b5787ea0c2f168ac80d344670df16be12614d37161a893ebed88d4c915384fcbc024996403&amp;scene=21#wechat_redirect\" textvalue=\"\u5e74\u85aa\u767e\u4e07\uff1a40\u5c81\u5c0f\u4f19\" linktype=\"text\" imgurl=\"\" imgdata=\"null\" data-itemshowtype=\"0\" tab=\"innerlink\" data-linktype=\"2\" hasload=\"1\" style=\"outline: 0px;color: var(--weui-LINK);cursor: pointer;\" rel=\"noopener\" rel=\"nofollow\" ><span style=\"outline: 0px;color: rgb(171, 25, 66);\"><strong style=\"outline: 0px;\">\u5e74\u85aa\u767e\u4e07\uff1a<\/strong>40\u5c81\u5c0f\u4f19\u88ab\u88c16\u4e2a\u6708\uff0c\u8ddf\u7740\u5c3c\u6069\u731b\u53773\u6708\u786c\u6838\u6280\u672f\uff0c100W\u5e74\u85aa\u9006\u88ad \uff0c\u4e0a\u5cb8\u79d8\u8bc0\uff1a\u9996\u5e2d\u67b6\u6784\/\u603b\u67b6\u6784<\/span><\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247485914&amp;idx=1&amp;sn=7832d0b63155f12eb8036321a99991c8&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u4e0d\u6015\u88c1\u5458\uff0c8\u5e74\u5c0f\u4f19\u53bb\u4e2d\u5e74\u5371\u673a\uff0c\u79d8\u8bc0\uff1a\u6362\u67b6\u6784\u5e08\u8d5b\u9053\uff0c\u4e0a\u5f97\u5385\u5802\uff0c\u4e0b\u5f97\u53a8\u623f\uff0c\u8d8a\u65e9\u8d8a\u597d<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247485881&amp;idx=1&amp;sn=97aae4d5edf8ea30d363e22ca86b5955&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u88ab\u88c1\u5458\u540e\u56e0\u7978\u5f97\u798f\uff0c\u62ffN+1\u540e\uff0c\u9006\u6da830%\uff0c\u5982\u4f55\u5b9e\u73b0\uff1f<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247485855&amp;idx=1&amp;sn=e9f6b1de7352f09d686c1481632fc454&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u9006\u5929\u5566\uff1a4\u5e74crud\u5c0f\u4f19\u6536shein+\u94f6\u884c\u4e24\u4f18\u8d28offer\uff0c\u72e0\u53771\u6708\u6536\u5e74\u85aa43\u4e07\u5927\u6da830%<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247485838&amp;idx=1&amp;sn=72d9733544a5310ee5068fc4533173ea&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u539f\u6765\uff0c\u62ff\u5927\u5382offer \u6709\u6377\u5f84......<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247485812&amp;idx=1&amp;sn=d87729bea8a8e22f3c2b3eb207d3b38b&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u592a\u52b2\u7206.... \u88ab\u88c14\u4e2a\u6708\uff0c38\u5c81Android\u8f6cJava\uff0c2\u4e2a\u6708\u63d0\u67b6\u6784offer<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247485780&amp;idx=1&amp;sn=03be191625369d33ac54b5c5066c7a68&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u8d77\u6b7b\u56de\u751f\uff1a8\u5e74\u5c0f\u4f19\u9ad8\u4e2d\u6bd5\u4e1a+\u9891\u7e41\u8df3\u69fd\uff0c\u72e0\u53772\u6708\uff0c\u63d0Java\u9ad8\u7ea7offer<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247485663&amp;idx=1&amp;sn=357ab76bc6695485b7941e8eb24a0b42&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u723d\u7ffb\u4e86\uff1a\u6307\u5bfc3\u8f6e\uff0c5\u5e74\u5c0f\u4f19\u65365\u5927offer\uff0c\u6da850%\uff0c\u9886\u8def\u6a21\u5f0f\u592a\u725b<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247485643&amp;idx=1&amp;sn=ce71b19e7c9745ab2fe8bfc75f54d993&amp;chksm=97b57943a0c2f055e5c085eec48586e9ba05ae661acabe4cfb7e984c5aeb03d6beeafd204eba&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u964d\u7ef4\u653b\u51fb\uff0c37\u5e74\u5927\u9f84\u8001\u4f19\u559c\u63d060W\u5e74\u85aaoffer\uff0c1\u4e2a\u6708\u987a\u5229\u4e0a\u5cb8<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247485571&amp;idx=1&amp;sn=c0096484fd2e1202c14a4bd9d37427c2&amp;chksm=97b5790ba0c2f01da764b8b7b5e3c8a5b02f42d2ed30809f9d7b2d8e73a5bebc9102ef502bc8&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u67b6\u6784\u901f\u6210\uff1a\u4ece\u4e00\u9762\u6740\u5230\u4e00\u6b21\u8fc7\uff0c\u8bb07\u5e74\u5973\u67b6\u6784\u7684\u901f\u6210\u7ecf\u5386<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzIxMzYwODY3OQ==&amp;mid=2247485452&amp;idx=1&amp;sn=68102559298564895b1496e2230dddb2&amp;chksm=97b57984a0c2f0927d80f8719a7dc56f43ff13e373eb3886d39be98538180f919225b5ac05f2&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u6781\u901f\u62ffoffer\uff1a\u963f\u91ccP6\u88ab\u88c1\u540e\u6781\u901f\u4e0a\u5cb8\uff0c1\u4e2a\u6708\u5185\u559c\u63d02\u4f18\u8d28offer(\u542b\u6ef4\u6ef4)<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzkxNzIyMTM1NQ==&amp;mid=2247496226&amp;idx=1&amp;sn=459a566cfa5915a720e80e1880fd730d&amp;chksm=c14148a6f636c1b08a321d08384c5d76e184c22f8f4457f980452c45c163bdc5ab91ca17b919&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u5927\u9006\u88ad\uff1a\u505a\u5316\u5de512\u5e74\uff0c35\u5c81\u8f6cJava\uff0c\u88ab\u88c14\u4e2a\u6708\u540e\uff0c1\u4e2a\u6708\u6536\u67b6\u6784Offer\uff0c\u5927\u9f84\u8de8\u884c\uff0c\u8d85\u7ea7\u725b<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzkxNzIyMTM1NQ==&amp;mid=2247492928&amp;idx=1&amp;sn=82fd1c530d0ad8ad798b5c35c040641b&amp;chksm=c1415fc4f636d6d25f16e12a73a2635073994ef742efdddcc1185c5d7727785c98fac14e8de8&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u88ab\u88c1\u540e\u70b8\u723d\uff1a10\u5e74\u5c0f\u4f1912\u5929\u706b\u901f\u4e0a\u5cb8\uff0c\u53cd\u6da820%\uff0c\u723d\u66b4\u4e86<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzkxNzIyMTM1NQ==&amp;mid=2247492621&amp;idx=1&amp;sn=f6ada03c596baedcf995e5cb60d255b2&amp;chksm=c1415e89f636d79f13b25d7f3691fb79931515f15b421d65fab1c5e34d4cce4165b6d1772737&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u88c1\u5c31\u88c1\uff0c6\u5e74\u5c0f\u4f1960W\u6781\u901f\u4e0a\u5cb8\uff0c\u767d\u62ff20W\u8fd8\u6e38\u4e00\u5708\u62c9\u8428\uff0c\u771f\u9999<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"http:\/\/mp.weixin.qq.com\/s?__biz=MzkxNzIyMTM1NQ==&amp;mid=2247491450&amp;idx=1&amp;sn=98379c07e430562a8a244121e63f47d7&amp;chksm=c142a5fef6352ce8e3ee64090a6d0619a9d40484f358302d96990e7655ec16f8d8e7624ca88e&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u6781\u901f\u62ffoffer\uff1a\u88ab\u6bd5\u4e1a3\u4e2a\u6708\uff0c11\u5e74\u7ecf\u9a8c\u5c0f\u4f190.5\u4e2a\u6708\u6781\u901f\u62ffoffer\uff0c\u9886\u8def\u6a21\u5f0f\u7684\u5de8\u5927\u5a01\u529b<\/a><\/p>\n<\/section>\n<\/li>\n<li style=\"outline: 0px;\">\n<section style=\"margin-top: 5px;margin-bottom: 5px;outline: 0px;line-height: 26px;color: rgb(1, 1, 1);font-size: 15px;font-family: &quot;Helvetica Neue&quot;, Helvetica, &quot;Segoe UI&quot;, Arial, freesans, sans-serif;\">\n<p style=\"margin-bottom: 16px;padding-top: 8px;padding-bottom: 8px;outline: 0px;color: black;line-height: 1.75em;\"><a href=\"https:\/\/mp.weixin.qq.com\/s?__biz=MzkxNzIyMTM1NQ==&amp;mid=2247491496&amp;idx=1&amp;sn=cb31f7510a7c2efb7daf6cad793860ad&amp;scene=21#wechat_redirect\" data-linktype=\"2\" style=\"outline: 0px;color: rgb(217, 33, 66);cursor: pointer;border-bottom-width: 0px;border-bottom-style: solid;\" target=\"_blank\"  rel=\"nofollow\" >\u60ca\u5929\u5927\u9006\u88ad\uff1a8\u5e74\u5c0f\u4f1920\u5929\u65f6\u95f4\u63d075W\u5e74\u85aaoffer\uff0c\u9006\u6da850%\uff0c\u79d8\u8bc0\u5728\u8fd9<\/a><\/p>\n<\/section>\n<\/li>\n<\/ul>\n<\/section>\n<section style=\"margin-bottom: 0px;outline: 0px;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 0.544px;text-wrap: wrap;background-color: rgb(255, 255, 255);min-width: 0px;border-width: 0px;border-style: initial;border-color: initial;font-size: 16.3636px;text-align: center;\">\n<section style=\"outline: 0px;display: inline-block;\">\n<section style=\"margin: 0em 0.5em 0.1em;outline: 0px;color: rgb(255, 108, 0);font-size: 1.8em;line-height: 1;\"><span style=\"outline: 0px;font-size: 20px;\"><strong data-brushtype=\"text\" style=\"outline: 0px;\">\u804c\u4e1a\u6551\u52a9\u7ad9<\/strong><\/span><\/section>\n<section data-brushtype=\"text\" style=\"margin: 0.5em 1em;outline: 0px;font-size: 1em;font-weight: inherit;text-align: inherit;text-decoration: inherit;line-height: 1;color: rgb(120, 124, 129);\">\n<p style=\"outline: 0px;\">\u5b9e\u73b0\u804c\u4e1a\u8f6c\u578b\uff0c\u6781\u901f\u4e0a\u5cb8<\/p>\n<p style=\"outline: 0px;\">\n<p style=\"outline: 0px;\"><img decoding=\"async\" border=\"0\" class=\"rich_pages wxw-img lazyload\" data-cropselx1=\"0\" data-cropselx2=\"190\" data-cropsely1=\"0\" data-cropsely2=\"190\" data-imgfileid=\"100017799\" data-ratio=\"1\"  data-type=\"jpeg\" data-w=\"258\" data-width=\"200px\" opacity=\"\" style=\"padding: 4px;outline: 0px;border-radius: 4px;border-width: 1px;border-style: solid;border-color: rgb(221, 221, 221);visibility: visible !important;width: 190px !important;\" title=\"\" vspace=\"0\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142929996.jpeg\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" border=\"0\" class=\"rich_pages wxw-img\" data-cropselx1=\"0\" data-cropselx2=\"190\" data-cropsely1=\"0\" data-cropsely2=\"190\" data-imgfileid=\"100017799\" data-ratio=\"1\"  data-type=\"jpeg\" data-w=\"258\" data-width=\"200px\" opacity=\"\" style=\"padding: 4px;outline: 0px;border-radius: 4px;border-width: 1px;border-style: solid;border-color: rgb(221, 221, 221);visibility: visible !important;width: 190px !important;\" title=\"\" vspace=\"0\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142929996.jpeg\"  \/><\/noscript><\/p>\n<\/section>\n<\/section>\n<\/section>\n<p style=\"margin-bottom: 0px;outline: 0px;text-wrap: wrap;color: rgb(62, 62, 62);font-family: \u5fae\u8f6f\u96c5\u9ed1;font-size: 12px;letter-spacing: 0.68px;text-align: center;background-color: rgb(255, 255, 255);line-height: 25.6px;\"><span style=\"outline: 0px;font-size: 14px;\">\u5173\u6ce8<strong style=\"outline: 0px;\">\u804c\u4e1a\u6551\u52a9\u7ad9<\/strong>\u516c\u4f17\u53f7\uff0c\u83b7\u53d6\u6bcf\u5929\u804c\u4e1a\u5e72\u8d27<\/span><span style=\"outline: 0px;font-size: 14px;\">\u52a9\u60a8\u5b9e\u73b0<strong style=\"outline: 0px;\">\u804c\u4e1a\u8f6c\u578b\u3001\u804c\u4e1a\u5347\u7ea7\u3001\u6781\u901f\u4e0a\u5cb8<\/strong>---------------------------------<\/span><\/p>\n<section style=\"margin-bottom: 0px;outline: 0px;font-family: system-ui, -apple-system, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 0.544px;text-wrap: wrap;background-color: rgb(255, 255, 255);min-width: 0px;border-width: 0px;border-style: initial;border-color: initial;font-size: 16.3636px;text-align: center;\">\n<section style=\"outline: 0px;display: inline-block;\">\n<section style=\"margin: 0em 0.5em 0.1em;outline: 0px;font-weight: inherit;color: rgb(255, 108, 0);font-size: 1.8em;line-height: 1;\"><span style=\"outline: 0px;font-size: 20px;\"><strong data-brushtype=\"text\" style=\"outline: 0px;\">\u6280\u672f\u81ea\u7531\u5708<\/strong><\/span><\/section>\n<section data-brushtype=\"text\" style=\"margin: 0.5em 1em;outline: 0px;font-size: 1em;font-weight: inherit;text-align: inherit;text-decoration: inherit;line-height: 1;color: rgb(120, 124, 129);\">\n<p style=\"outline: 0px;\">\u5b9e\u73b0\u67b6\u6784\u8f6c\u578b\uff0c\u518d\u65e0\u4e2d\u5e74\u5371\u673a<\/p>\n<p style=\"outline: 0px;\">\n<p style=\"outline: 0px;\"><img decoding=\"async\" border=\"0\" class=\"rich_pages wxw-img lazyload\" data-imgfileid=\"100017798\" data-ratio=\"1\"  data-type=\"jpeg\" data-w=\"258\" data-width=\"200px\" height=\"\" opacity=\"\" style=\"padding: 4px;outline: 0px;border-radius: 4px;border-width: 1px;border-style: solid;border-color: rgb(221, 221, 221);visibility: visible !important;width: 200px !important;\" title=\"\" vspace=\"0\" width=\"200px\" data-src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142931581.jpeg\" src=\"https:\/\/s.nmxc.ltd\/sakurairo_vision\/@2.6\/load_svg\/inload.svg\" onerror=\"imgError(this)\"  \/><noscript><img decoding=\"async\" border=\"0\" class=\"rich_pages wxw-img\" data-imgfileid=\"100017798\" data-ratio=\"1\"  data-type=\"jpeg\" data-w=\"258\" data-width=\"200px\" height=\"\" opacity=\"\" style=\"padding: 4px;outline: 0px;border-radius: 4px;border-width: 1px;border-style: solid;border-color: rgb(221, 221, 221);visibility: visible !important;width: 200px !important;\" title=\"\" vspace=\"0\" width=\"200px\" src=\"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142931581.jpeg\"  \/><\/noscript><span style=\"outline: 0px;color: rgb(62, 62, 62);\"><\/span><\/p>\n<\/section>\n<\/section>\n<\/section>\n<p style=\"margin-bottom: 0px;outline: 0px;text-wrap: wrap;color: rgb(62, 62, 62);font-family: \u5fae\u8f6f\u96c5\u9ed1;font-size: 12px;letter-spacing: 0.68px;text-align: center;background-color: rgb(255, 255, 255);line-height: 25.6px;\"><span style=\"outline: 0px;font-size: 14px;\">\u5173\u6ce8<strong style=\"outline: 0px;\">\u6280\u672f\u81ea\u7531\u5708<\/strong>\u516c\u4f17\u53f7\uff0c\u83b7\u53d6\u6bcf\u5929\u6280\u672f\u5343\u8d27<\/span><span style=\"outline: 0px;font-size: 14px;\">\u4e00\u8d77\u6210\u4e3a\u725b\u903c\u7684<strong style=\"outline: 0px;\">\u672a\u6765\u8d85\u7ea7\u67b6\u6784\u5e08<\/strong><\/span><\/p>\n<p style=\"margin-bottom: 0px;outline: 0px;text-wrap: wrap;color: rgb(62, 62, 62);font-family: \u5fae\u8f6f\u96c5\u9ed1;font-size: 12px;letter-spacing: 0.68px;text-align: center;background-color: rgb(255, 255, 255);line-height: 25.6px;\"><strong style=\"outline: 0px;\">\u51e0\u5341\u7bc7\u67b6\u6784\u7b14\u8bb0\u30015000\u9875\u9762\u8bd5\u5b9d\u5178\u300120\u4e2a\u6280\u672f\u5723\u7ecf<span style=\"outline: 0px;font-size: 18px;color: rgb(255, 108, 0);\">\u8bf7\u52a0\u5c3c\u6069\u4e2a\u4eba\u5fae\u4fe1<\/span><span style=\"outline: 0px;font-size: 18px;color: rgb(61, 167, 66);\">\u514d\u8d39\u62ff\u8d70<\/span><\/strong><\/p>\n<p style=\"margin-bottom: 0px;outline: 0px;text-wrap: wrap;color: rgb(62, 62, 62);font-family: \u5fae\u8f6f\u96c5\u9ed1;font-size: 12px;letter-spacing: 0.68px;text-align: center;background-color: rgb(255, 255, 255);line-height: 25.6px;\"><strong style=\"outline: 0px;\"><span style=\"outline: 0px;font-size: 16px;color: rgb(255, 108, 0);\">\u6697\u53f7<\/span>\uff0c\u8bf7\u5728 \u516c\u4f17\u53f7\u540e\u53f0 \u53d1\u9001\u6d88\u606f\uff1a<span style=\"outline: 0px;font-size: 16px;color: rgb(255, 108, 0);\">\u9886\u7535\u5b50\u4e66<\/span><\/strong><\/p>\n<p style=\"margin-bottom: 0px;outline: 0px;color: rgb(62, 62, 62);font-family: \u5fae\u8f6f\u96c5\u9ed1;font-size: 12px;letter-spacing: 0.68px;text-align: center;background-color: rgb(255, 255, 255);line-height: 25.6px;\"><span style=\"outline: 0px;font-size: 14px;\">\u5982\u6709\u6536\u83b7\uff0c\u8bf7\u70b9\u51fb\u5e95\u90e8\u7684\"<span style=\"outline: 0px;font-size: 16px;color: rgb(2, 30, 170);\">\u5728\u770b<\/span>\"\u548c\"<span style=\"outline: 0px;font-size: 16px;color: rgb(2, 30, 170);\">\u8d5e<\/span>\"\uff0c\u8c22\u8c22<\/span><\/p>\n<p style=\"display: none;\"><mp-style-type data-value=\"3\"><\/mp-style-type><\/p>\n<blockquote>\n<p>\u672c\u7bc7\u6587\u7ae0\u6765\u6e90\u4e8e\u5fae\u4fe1\u516c\u4f17\u53f7:                 \u6280\u672f\u81ea\u7531\u5708              <\/p>\n<\/blockquote>\n<\/div>\n","raw":"","protected":false},"excerpt":{"rendered":"<p>FSAC\u672a\u6765\u8d85\u7ea7\u67b6\u6784\u5e08 \u67b6\u6784\u5e08\u603b\u52a8\u5458\u5b9e\u73b0\u67b6\u6784\u8f6c\u578b\uff0c\u518d\u65e0\u4e2d\u5e74\u5371\u673a \u5c3c\u6069\u8bf4\u5728\u524d\u9762 \u572840\u5c81\u8001\u67b6\u6784\u5e08 \u5c3c\u6069\u7684\u8bfb\u8005\u4ea4\u6d41\u7fa4(50+)\u4e2d\uff0c\u5f88\u591a &#8230;<\/p>\n","protected":false},"author":1,"featured_media":3820,"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-3844","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\/2024\/05\/20240524142811589-150x150.jpeg","content_first_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142815441.png","post_medium_image_300":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142811589-300x128.jpeg","post_thumbnail_image_624":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142811589.jpeg","post_frist_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142815441.png","post_medium_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142811589-300x128.jpeg","post_large_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142811589.jpeg","post_full_image":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142811589.jpeg","post_all_images":[{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142815441.png","id":"image0"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142815441.png","id":"image1"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142827302.png","id":"image2"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142827302.png","id":"image3"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142829694.png","id":"image4"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142829694.png","id":"image5"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142833101.png","id":"image6"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142833101.png","id":"image7"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142837900.png","id":"image8"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142837900.png","id":"image9"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142840487.png","id":"image10"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142840487.png","id":"image11"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142844199.png","id":"image12"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142844199.png","id":"image13"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142847520.png","id":"image14"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142847520.png","id":"image15"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142849347.png","id":"image16"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142849347.png","id":"image17"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142853205.png","id":"image18"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142853205.png","id":"image19"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142858890.png","id":"image20"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142858890.png","id":"image21"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142902191.png","id":"image22"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142902191.png","id":"image23"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142907247.png","id":"image24"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142907247.png","id":"image25"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142910313.png","id":"image26"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142910313.png","id":"image27"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142912535.png","id":"image28"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142912535.png","id":"image29"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142918494.png","id":"image30"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142918494.png","id":"image31"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142921649.png","id":"image32"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142921649.png","id":"image33"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142924664.png","id":"image34"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142924664.png","id":"image35"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142926476.png","id":"image36"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142926476.png","id":"image37"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142929996.jpeg","id":"image38"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142929996.jpeg","id":"image39"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142931581.jpeg","id":"image40"},{"imagesurl":"https:\/\/wp-moto-1258805347.cos.ap-shanghai.myqcloud.com\/2024\/05\/20240524142931581.jpeg","id":"image41"}],"videoAdId":"","listAd":"0","listAdId":"","listAdEvery":6,"total_comments":0,"category_name":"Java","post_date":"2024-04-12","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":256,"next_post_id":3962,"next_post_title":"\u9762\u8bd5\u5b98\uff1aConcurrentHashMap\u5141\u8bb8\u591a\u5c11\u4e2a\u7ebf\u7a0b\u540c\u65f6\u5199\u5165\uff1f","previous_post_id":3767,"previous_post_title":"\u5e38\u7528Swagger\u6ce8\u89e3\u6c47\u603b","_links":{"self":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/3844","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=3844"}],"version-history":[{"count":0,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/posts\/3844\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media\/3820"}],"wp:attachment":[{"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/media?parent=3844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/categories?post=3844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xinchewhd.com.cn\/index.php\/wp-json\/wp\/v2\/tags?post=3844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}