线程及线程池
线程状态线程池原理线程池状态线程池分类ThreadPoolExecutorScheduledThreadPoolExecutorForkJoinPool
线程池排队策略Direct Handoffs (e.g. SynchronouseQueue)Unbounded queues (e.g. LinkedBlockingQueue)Bounded queues(e.g. ArrayBlockingQueue)
线程池拒绝策略线程池终止(Finalization)阻塞队列ArrayBlockingQueueLinkedBlockingQueueDelayQueuePriorityQueueSynchronouseQueue
线程状态
#mermaid-svg-854zcBiC36W8eRX4 .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-854zcBiC36W8eRX4 .label text{fill:#333}#mermaid-svg-854zcBiC36W8eRX4 .node rect,#mermaid-svg-854zcBiC36W8eRX4 .node circle,#mermaid-svg-854zcBiC36W8eRX4 .node ellipse,#mermaid-svg-854zcBiC36W8eRX4 .node polygon,#mermaid-svg-854zcBiC36W8eRX4 .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-854zcBiC36W8eRX4 .node .label{text-align:center;fill:#333}#mermaid-svg-854zcBiC36W8eRX4 .node.clickable{cursor:pointer}#mermaid-svg-854zcBiC36W8eRX4 .arrowheadPath{fill:#333}#mermaid-svg-854zcBiC36W8eRX4 .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-854zcBiC36W8eRX4 .flowchart-link{stroke:#333;fill:none}#mermaid-svg-854zcBiC36W8eRX4 .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-854zcBiC36W8eRX4 .edgeLabel rect{opacity:0.9}#mermaid-svg-854zcBiC36W8eRX4 .edgeLabel span{color:#333}#mermaid-svg-854zcBiC36W8eRX4 .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-854zcBiC36W8eRX4 .cluster text{fill:#333}#mermaid-svg-854zcBiC36W8eRX4 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-854zcBiC36W8eRX4 .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-854zcBiC36W8eRX4 text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-854zcBiC36W8eRX4 .actor-line{stroke:grey}#mermaid-svg-854zcBiC36W8eRX4 .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-854zcBiC36W8eRX4 .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-854zcBiC36W8eRX4 #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-854zcBiC36W8eRX4 .sequenceNumber{fill:#fff}#mermaid-svg-854zcBiC36W8eRX4 #sequencenumber{fill:#333}#mermaid-svg-854zcBiC36W8eRX4 #crosshead path{fill:#333;stroke:#333}#mermaid-svg-854zcBiC36W8eRX4 .messageText{fill:#333;stroke:#333}#mermaid-svg-854zcBiC36W8eRX4 .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-854zcBiC36W8eRX4 .labelText,#mermaid-svg-854zcBiC36W8eRX4 .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-854zcBiC36W8eRX4 .loopText,#mermaid-svg-854zcBiC36W8eRX4 .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-854zcBiC36W8eRX4 .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-854zcBiC36W8eRX4 .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-854zcBiC36W8eRX4 .noteText,#mermaid-svg-854zcBiC36W8eRX4 .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-854zcBiC36W8eRX4 .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-854zcBiC36W8eRX4 .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-854zcBiC36W8eRX4 .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-854zcBiC36W8eRX4 .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-854zcBiC36W8eRX4 .section{stroke:none;opacity:0.2}#mermaid-svg-854zcBiC36W8eRX4 .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-854zcBiC36W8eRX4 .section2{fill:#fff400}#mermaid-svg-854zcBiC36W8eRX4 .section1,#mermaid-svg-854zcBiC36W8eRX4 .section3{fill:#fff;opacity:0.2}#mermaid-svg-854zcBiC36W8eRX4 .sectionTitle0{fill:#333}#mermaid-svg-854zcBiC36W8eRX4 .sectionTitle1{fill:#333}#mermaid-svg-854zcBiC36W8eRX4 .sectionTitle2{fill:#333}#mermaid-svg-854zcBiC36W8eRX4 .sectionTitle3{fill:#333}#mermaid-svg-854zcBiC36W8eRX4 .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-854zcBiC36W8eRX4 .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-854zcBiC36W8eRX4 .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-854zcBiC36W8eRX4 .grid path{stroke-width:0}#mermaid-svg-854zcBiC36W8eRX4 .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-854zcBiC36W8eRX4 .task{stroke-width:2}#mermaid-svg-854zcBiC36W8eRX4 .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-854zcBiC36W8eRX4 .taskText:not([font-size]){font-size:11px}#mermaid-svg-854zcBiC36W8eRX4 .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-854zcBiC36W8eRX4 .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-854zcBiC36W8eRX4 .task.clickable{cursor:pointer}#mermaid-svg-854zcBiC36W8eRX4 .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-854zcBiC36W8eRX4 .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-854zcBiC36W8eRX4 .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-854zcBiC36W8eRX4 .taskText0,#mermaid-svg-854zcBiC36W8eRX4 .taskText1,#mermaid-svg-854zcBiC36W8eRX4 .taskText2,#mermaid-svg-854zcBiC36W8eRX4 .taskText3{fill:#fff}#mermaid-svg-854zcBiC36W8eRX4 .task0,#mermaid-svg-854zcBiC36W8eRX4 .task1,#mermaid-svg-854zcBiC36W8eRX4 .task2,#mermaid-svg-854zcBiC36W8eRX4 .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-854zcBiC36W8eRX4 .taskTextOutside0,#mermaid-svg-854zcBiC36W8eRX4 .taskTextOutside2{fill:#000}#mermaid-svg-854zcBiC36W8eRX4 .taskTextOutside1,#mermaid-svg-854zcBiC36W8eRX4 .taskTextOutside3{fill:#000}#mermaid-svg-854zcBiC36W8eRX4 .active0,#mermaid-svg-854zcBiC36W8eRX4 .active1,#mermaid-svg-854zcBiC36W8eRX4 .active2,#mermaid-svg-854zcBiC36W8eRX4 .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-854zcBiC36W8eRX4 .activeText0,#mermaid-svg-854zcBiC36W8eRX4 .activeText1,#mermaid-svg-854zcBiC36W8eRX4 .activeText2,#mermaid-svg-854zcBiC36W8eRX4 .activeText3{fill:#000 !important}#mermaid-svg-854zcBiC36W8eRX4 .done0,#mermaid-svg-854zcBiC36W8eRX4 .done1,#mermaid-svg-854zcBiC36W8eRX4 .done2,#mermaid-svg-854zcBiC36W8eRX4 .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-854zcBiC36W8eRX4 .doneText0,#mermaid-svg-854zcBiC36W8eRX4 .doneText1,#mermaid-svg-854zcBiC36W8eRX4 .doneText2,#mermaid-svg-854zcBiC36W8eRX4 .doneText3{fill:#000 !important}#mermaid-svg-854zcBiC36W8eRX4 .crit0,#mermaid-svg-854zcBiC36W8eRX4 .crit1,#mermaid-svg-854zcBiC36W8eRX4 .crit2,#mermaid-svg-854zcBiC36W8eRX4 .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-854zcBiC36W8eRX4 .activeCrit0,#mermaid-svg-854zcBiC36W8eRX4 .activeCrit1,#mermaid-svg-854zcBiC36W8eRX4 .activeCrit2,#mermaid-svg-854zcBiC36W8eRX4 .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-854zcBiC36W8eRX4 .doneCrit0,#mermaid-svg-854zcBiC36W8eRX4 .doneCrit1,#mermaid-svg-854zcBiC36W8eRX4 .doneCrit2,#mermaid-svg-854zcBiC36W8eRX4 .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-854zcBiC36W8eRX4 .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-854zcBiC36W8eRX4 .milestoneText{font-style:italic}#mermaid-svg-854zcBiC36W8eRX4 .doneCritText0,#mermaid-svg-854zcBiC36W8eRX4 .doneCritText1,#mermaid-svg-854zcBiC36W8eRX4 .doneCritText2,#mermaid-svg-854zcBiC36W8eRX4 .doneCritText3{fill:#000 !important}#mermaid-svg-854zcBiC36W8eRX4 .activeCritText0,#mermaid-svg-854zcBiC36W8eRX4 .activeCritText1,#mermaid-svg-854zcBiC36W8eRX4 .activeCritText2,#mermaid-svg-854zcBiC36W8eRX4 .activeCritText3{fill:#000 !important}#mermaid-svg-854zcBiC36W8eRX4 .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-854zcBiC36W8eRX4 g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-854zcBiC36W8eRX4 g.classGroup text .title{font-weight:bolder}#mermaid-svg-854zcBiC36W8eRX4 g.clickable{cursor:pointer}#mermaid-svg-854zcBiC36W8eRX4 g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-854zcBiC36W8eRX4 g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-854zcBiC36W8eRX4 .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-854zcBiC36W8eRX4 .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-854zcBiC36W8eRX4 .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-854zcBiC36W8eRX4 .dashed-line{stroke-dasharray:3}#mermaid-svg-854zcBiC36W8eRX4 #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-854zcBiC36W8eRX4 #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-854zcBiC36W8eRX4 #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-854zcBiC36W8eRX4 #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-854zcBiC36W8eRX4 #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-854zcBiC36W8eRX4 #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-854zcBiC36W8eRX4 #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-854zcBiC36W8eRX4 #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-854zcBiC36W8eRX4 .commit-id,#mermaid-svg-854zcBiC36W8eRX4 .commit-msg,#mermaid-svg-854zcBiC36W8eRX4 .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-854zcBiC36W8eRX4 .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-854zcBiC36W8eRX4 .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-854zcBiC36W8eRX4 g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-854zcBiC36W8eRX4 g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-854zcBiC36W8eRX4 g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-854zcBiC36W8eRX4 g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-854zcBiC36W8eRX4 g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-854zcBiC36W8eRX4 g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-854zcBiC36W8eRX4 .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-854zcBiC36W8eRX4 .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-854zcBiC36W8eRX4 .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-854zcBiC36W8eRX4 .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-854zcBiC36W8eRX4 .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-854zcBiC36W8eRX4 .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-854zcBiC36W8eRX4 .edgeLabel text{fill:#333}#mermaid-svg-854zcBiC36W8eRX4 .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-854zcBiC36W8eRX4 .node circle.state-start{fill:black;stroke:black}#mermaid-svg-854zcBiC36W8eRX4 .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-854zcBiC36W8eRX4 #statediagram-barbEnd{fill:#9370db}#mermaid-svg-854zcBiC36W8eRX4 .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-854zcBiC36W8eRX4 .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-854zcBiC36W8eRX4 .statediagram-state .divider{stroke:#9370db}#mermaid-svg-854zcBiC36W8eRX4 .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-854zcBiC36W8eRX4 .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-854zcBiC36W8eRX4 .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-854zcBiC36W8eRX4 .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-854zcBiC36W8eRX4 .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-854zcBiC36W8eRX4 .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-854zcBiC36W8eRX4 .note-edge{stroke-dasharray:5}#mermaid-svg-854zcBiC36W8eRX4 .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-854zcBiC36W8eRX4 .error-icon{fill:#522}#mermaid-svg-854zcBiC36W8eRX4 .error-text{fill:#522;stroke:#522}#mermaid-svg-854zcBiC36W8eRX4 .edge-thickness-normal{stroke-width:2px}#mermaid-svg-854zcBiC36W8eRX4 .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-854zcBiC36W8eRX4 .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-854zcBiC36W8eRX4 .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-854zcBiC36W8eRX4 .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-854zcBiC36W8eRX4 .marker{fill:#333}#mermaid-svg-854zcBiC36W8eRX4 .marker.cross{stroke:#333}
:root { --mermaid-font-family: "trebuchet ms", verdana, arial;}
#mermaid-svg-854zcBiC36W8eRX4 {
color: rgba(0, 0, 0, 0.75);
font: ;
}
start
阻塞
阻塞解除
创建
就绪
运行
死亡
阻塞
多线程中可以实现唤醒和等待的过程,但是这不是针对Thread类或对象,而是设置的共享对象
线程池原理
#mermaid-svg-nDGBlCYoq0AiA7PX .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-nDGBlCYoq0AiA7PX .label text{fill:#333}#mermaid-svg-nDGBlCYoq0AiA7PX .node rect,#mermaid-svg-nDGBlCYoq0AiA7PX .node circle,#mermaid-svg-nDGBlCYoq0AiA7PX .node ellipse,#mermaid-svg-nDGBlCYoq0AiA7PX .node polygon,#mermaid-svg-nDGBlCYoq0AiA7PX .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-nDGBlCYoq0AiA7PX .node .label{text-align:center;fill:#333}#mermaid-svg-nDGBlCYoq0AiA7PX .node.clickable{cursor:pointer}#mermaid-svg-nDGBlCYoq0AiA7PX .arrowheadPath{fill:#333}#mermaid-svg-nDGBlCYoq0AiA7PX .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-nDGBlCYoq0AiA7PX .flowchart-link{stroke:#333;fill:none}#mermaid-svg-nDGBlCYoq0AiA7PX .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-nDGBlCYoq0AiA7PX .edgeLabel rect{opacity:0.9}#mermaid-svg-nDGBlCYoq0AiA7PX .edgeLabel span{color:#333}#mermaid-svg-nDGBlCYoq0AiA7PX .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-nDGBlCYoq0AiA7PX .cluster text{fill:#333}#mermaid-svg-nDGBlCYoq0AiA7PX div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-nDGBlCYoq0AiA7PX .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-nDGBlCYoq0AiA7PX text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-nDGBlCYoq0AiA7PX .actor-line{stroke:grey}#mermaid-svg-nDGBlCYoq0AiA7PX .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-nDGBlCYoq0AiA7PX .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-nDGBlCYoq0AiA7PX #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-nDGBlCYoq0AiA7PX .sequenceNumber{fill:#fff}#mermaid-svg-nDGBlCYoq0AiA7PX #sequencenumber{fill:#333}#mermaid-svg-nDGBlCYoq0AiA7PX #crosshead path{fill:#333;stroke:#333}#mermaid-svg-nDGBlCYoq0AiA7PX .messageText{fill:#333;stroke:#333}#mermaid-svg-nDGBlCYoq0AiA7PX .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-nDGBlCYoq0AiA7PX .labelText,#mermaid-svg-nDGBlCYoq0AiA7PX .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-nDGBlCYoq0AiA7PX .loopText,#mermaid-svg-nDGBlCYoq0AiA7PX .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-nDGBlCYoq0AiA7PX .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-nDGBlCYoq0AiA7PX .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-nDGBlCYoq0AiA7PX .noteText,#mermaid-svg-nDGBlCYoq0AiA7PX .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-nDGBlCYoq0AiA7PX .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-nDGBlCYoq0AiA7PX .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-nDGBlCYoq0AiA7PX .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-nDGBlCYoq0AiA7PX .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-nDGBlCYoq0AiA7PX .section{stroke:none;opacity:0.2}#mermaid-svg-nDGBlCYoq0AiA7PX .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-nDGBlCYoq0AiA7PX .section2{fill:#fff400}#mermaid-svg-nDGBlCYoq0AiA7PX .section1,#mermaid-svg-nDGBlCYoq0AiA7PX .section3{fill:#fff;opacity:0.2}#mermaid-svg-nDGBlCYoq0AiA7PX .sectionTitle0{fill:#333}#mermaid-svg-nDGBlCYoq0AiA7PX .sectionTitle1{fill:#333}#mermaid-svg-nDGBlCYoq0AiA7PX .sectionTitle2{fill:#333}#mermaid-svg-nDGBlCYoq0AiA7PX .sectionTitle3{fill:#333}#mermaid-svg-nDGBlCYoq0AiA7PX .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-nDGBlCYoq0AiA7PX .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-nDGBlCYoq0AiA7PX .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-nDGBlCYoq0AiA7PX .grid path{stroke-width:0}#mermaid-svg-nDGBlCYoq0AiA7PX .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-nDGBlCYoq0AiA7PX .task{stroke-width:2}#mermaid-svg-nDGBlCYoq0AiA7PX .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-nDGBlCYoq0AiA7PX .taskText:not([font-size]){font-size:11px}#mermaid-svg-nDGBlCYoq0AiA7PX .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-nDGBlCYoq0AiA7PX .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-nDGBlCYoq0AiA7PX .task.clickable{cursor:pointer}#mermaid-svg-nDGBlCYoq0AiA7PX .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-nDGBlCYoq0AiA7PX .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-nDGBlCYoq0AiA7PX .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-nDGBlCYoq0AiA7PX .taskText0,#mermaid-svg-nDGBlCYoq0AiA7PX .taskText1,#mermaid-svg-nDGBlCYoq0AiA7PX .taskText2,#mermaid-svg-nDGBlCYoq0AiA7PX .taskText3{fill:#fff}#mermaid-svg-nDGBlCYoq0AiA7PX .task0,#mermaid-svg-nDGBlCYoq0AiA7PX .task1,#mermaid-svg-nDGBlCYoq0AiA7PX .task2,#mermaid-svg-nDGBlCYoq0AiA7PX .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-nDGBlCYoq0AiA7PX .taskTextOutside0,#mermaid-svg-nDGBlCYoq0AiA7PX .taskTextOutside2{fill:#000}#mermaid-svg-nDGBlCYoq0AiA7PX .taskTextOutside1,#mermaid-svg-nDGBlCYoq0AiA7PX .taskTextOutside3{fill:#000}#mermaid-svg-nDGBlCYoq0AiA7PX .active0,#mermaid-svg-nDGBlCYoq0AiA7PX .active1,#mermaid-svg-nDGBlCYoq0AiA7PX .active2,#mermaid-svg-nDGBlCYoq0AiA7PX .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-nDGBlCYoq0AiA7PX .activeText0,#mermaid-svg-nDGBlCYoq0AiA7PX .activeText1,#mermaid-svg-nDGBlCYoq0AiA7PX .activeText2,#mermaid-svg-nDGBlCYoq0AiA7PX .activeText3{fill:#000 !important}#mermaid-svg-nDGBlCYoq0AiA7PX .done0,#mermaid-svg-nDGBlCYoq0AiA7PX .done1,#mermaid-svg-nDGBlCYoq0AiA7PX .done2,#mermaid-svg-nDGBlCYoq0AiA7PX .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-nDGBlCYoq0AiA7PX .doneText0,#mermaid-svg-nDGBlCYoq0AiA7PX .doneText1,#mermaid-svg-nDGBlCYoq0AiA7PX .doneText2,#mermaid-svg-nDGBlCYoq0AiA7PX .doneText3{fill:#000 !important}#mermaid-svg-nDGBlCYoq0AiA7PX .crit0,#mermaid-svg-nDGBlCYoq0AiA7PX .crit1,#mermaid-svg-nDGBlCYoq0AiA7PX .crit2,#mermaid-svg-nDGBlCYoq0AiA7PX .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-nDGBlCYoq0AiA7PX .activeCrit0,#mermaid-svg-nDGBlCYoq0AiA7PX .activeCrit1,#mermaid-svg-nDGBlCYoq0AiA7PX .activeCrit2,#mermaid-svg-nDGBlCYoq0AiA7PX .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-nDGBlCYoq0AiA7PX .doneCrit0,#mermaid-svg-nDGBlCYoq0AiA7PX .doneCrit1,#mermaid-svg-nDGBlCYoq0AiA7PX .doneCrit2,#mermaid-svg-nDGBlCYoq0AiA7PX .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-nDGBlCYoq0AiA7PX .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-nDGBlCYoq0AiA7PX .milestoneText{font-style:italic}#mermaid-svg-nDGBlCYoq0AiA7PX .doneCritText0,#mermaid-svg-nDGBlCYoq0AiA7PX .doneCritText1,#mermaid-svg-nDGBlCYoq0AiA7PX .doneCritText2,#mermaid-svg-nDGBlCYoq0AiA7PX .doneCritText3{fill:#000 !important}#mermaid-svg-nDGBlCYoq0AiA7PX .activeCritText0,#mermaid-svg-nDGBlCYoq0AiA7PX .activeCritText1,#mermaid-svg-nDGBlCYoq0AiA7PX .activeCritText2,#mermaid-svg-nDGBlCYoq0AiA7PX .activeCritText3{fill:#000 !important}#mermaid-svg-nDGBlCYoq0AiA7PX .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-nDGBlCYoq0AiA7PX g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-nDGBlCYoq0AiA7PX g.classGroup text .title{font-weight:bolder}#mermaid-svg-nDGBlCYoq0AiA7PX g.clickable{cursor:pointer}#mermaid-svg-nDGBlCYoq0AiA7PX g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-nDGBlCYoq0AiA7PX g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-nDGBlCYoq0AiA7PX .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-nDGBlCYoq0AiA7PX .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-nDGBlCYoq0AiA7PX .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-nDGBlCYoq0AiA7PX .dashed-line{stroke-dasharray:3}#mermaid-svg-nDGBlCYoq0AiA7PX #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-nDGBlCYoq0AiA7PX #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-nDGBlCYoq0AiA7PX #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-nDGBlCYoq0AiA7PX #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-nDGBlCYoq0AiA7PX #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-nDGBlCYoq0AiA7PX #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-nDGBlCYoq0AiA7PX #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-nDGBlCYoq0AiA7PX #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-nDGBlCYoq0AiA7PX .commit-id,#mermaid-svg-nDGBlCYoq0AiA7PX .commit-msg,#mermaid-svg-nDGBlCYoq0AiA7PX .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-nDGBlCYoq0AiA7PX .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-nDGBlCYoq0AiA7PX .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-nDGBlCYoq0AiA7PX g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-nDGBlCYoq0AiA7PX g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-nDGBlCYoq0AiA7PX g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-nDGBlCYoq0AiA7PX g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-nDGBlCYoq0AiA7PX g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-nDGBlCYoq0AiA7PX g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-nDGBlCYoq0AiA7PX .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-nDGBlCYoq0AiA7PX .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-nDGBlCYoq0AiA7PX .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-nDGBlCYoq0AiA7PX .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-nDGBlCYoq0AiA7PX .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-nDGBlCYoq0AiA7PX .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-nDGBlCYoq0AiA7PX .edgeLabel text{fill:#333}#mermaid-svg-nDGBlCYoq0AiA7PX .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-nDGBlCYoq0AiA7PX .node circle.state-start{fill:black;stroke:black}#mermaid-svg-nDGBlCYoq0AiA7PX .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-nDGBlCYoq0AiA7PX #statediagram-barbEnd{fill:#9370db}#mermaid-svg-nDGBlCYoq0AiA7PX .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-nDGBlCYoq0AiA7PX .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-nDGBlCYoq0AiA7PX .statediagram-state .divider{stroke:#9370db}#mermaid-svg-nDGBlCYoq0AiA7PX .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-nDGBlCYoq0AiA7PX .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-nDGBlCYoq0AiA7PX .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-nDGBlCYoq0AiA7PX .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-nDGBlCYoq0AiA7PX .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-nDGBlCYoq0AiA7PX .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-nDGBlCYoq0AiA7PX .note-edge{stroke-dasharray:5}#mermaid-svg-nDGBlCYoq0AiA7PX .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-nDGBlCYoq0AiA7PX .error-icon{fill:#522}#mermaid-svg-nDGBlCYoq0AiA7PX .error-text{fill:#522;stroke:#522}#mermaid-svg-nDGBlCYoq0AiA7PX .edge-thickness-normal{stroke-width:2px}#mermaid-svg-nDGBlCYoq0AiA7PX .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-nDGBlCYoq0AiA7PX .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-nDGBlCYoq0AiA7PX .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-nDGBlCYoq0AiA7PX .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-nDGBlCYoq0AiA7PX .marker{fill:#333}#mermaid-svg-nDGBlCYoq0AiA7PX .marker.cross{stroke:#333}
:root { --mermaid-font-family: "trebuchet ms", verdana, arial;}
#mermaid-svg-nDGBlCYoq0AiA7PX {
color: rgba(0, 0, 0, 0.75);
font: ;
}
不是
是
是
不是
是
不是
提交任务
核心线程池是否已满
创建新的线程执行任务
待执行任务队列是否已满
线程池是否已满
饱和策略处理
放入待执行任务队列
在核心线程池未满的情况下,新提交的任务总是新建线程执行超过核心线程池大小的空闲线程在keepAliveTime之后将被终止,但是,核心线程池在keepAliveTime大于0的情况下,也是可以使用timeout策略
线程池状态
#mermaid-svg-JjO46weci89Nzqu4 .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-JjO46weci89Nzqu4 .label text{fill:#333}#mermaid-svg-JjO46weci89Nzqu4 .node rect,#mermaid-svg-JjO46weci89Nzqu4 .node circle,#mermaid-svg-JjO46weci89Nzqu4 .node ellipse,#mermaid-svg-JjO46weci89Nzqu4 .node polygon,#mermaid-svg-JjO46weci89Nzqu4 .node path{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-JjO46weci89Nzqu4 .node .label{text-align:center;fill:#333}#mermaid-svg-JjO46weci89Nzqu4 .node.clickable{cursor:pointer}#mermaid-svg-JjO46weci89Nzqu4 .arrowheadPath{fill:#333}#mermaid-svg-JjO46weci89Nzqu4 .edgePath .path{stroke:#333;stroke-width:1.5px}#mermaid-svg-JjO46weci89Nzqu4 .flowchart-link{stroke:#333;fill:none}#mermaid-svg-JjO46weci89Nzqu4 .edgeLabel{background-color:#e8e8e8;text-align:center}#mermaid-svg-JjO46weci89Nzqu4 .edgeLabel rect{opacity:0.9}#mermaid-svg-JjO46weci89Nzqu4 .edgeLabel span{color:#333}#mermaid-svg-JjO46weci89Nzqu4 .cluster rect{fill:#ffffde;stroke:#aa3;stroke-width:1px}#mermaid-svg-JjO46weci89Nzqu4 .cluster text{fill:#333}#mermaid-svg-JjO46weci89Nzqu4 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:12px;background:#ffffde;border:1px solid #aa3;border-radius:2px;pointer-events:none;z-index:100}#mermaid-svg-JjO46weci89Nzqu4 .actor{stroke:#ccf;fill:#ECECFF}#mermaid-svg-JjO46weci89Nzqu4 text.actor>tspan{fill:#000;stroke:none}#mermaid-svg-JjO46weci89Nzqu4 .actor-line{stroke:grey}#mermaid-svg-JjO46weci89Nzqu4 .messageLine0{stroke-width:1.5;stroke-dasharray:none;stroke:#333}#mermaid-svg-JjO46weci89Nzqu4 .messageLine1{stroke-width:1.5;stroke-dasharray:2, 2;stroke:#333}#mermaid-svg-JjO46weci89Nzqu4 #arrowhead path{fill:#333;stroke:#333}#mermaid-svg-JjO46weci89Nzqu4 .sequenceNumber{fill:#fff}#mermaid-svg-JjO46weci89Nzqu4 #sequencenumber{fill:#333}#mermaid-svg-JjO46weci89Nzqu4 #crosshead path{fill:#333;stroke:#333}#mermaid-svg-JjO46weci89Nzqu4 .messageText{fill:#333;stroke:#333}#mermaid-svg-JjO46weci89Nzqu4 .labelBox{stroke:#ccf;fill:#ECECFF}#mermaid-svg-JjO46weci89Nzqu4 .labelText,#mermaid-svg-JjO46weci89Nzqu4 .labelText>tspan{fill:#000;stroke:none}#mermaid-svg-JjO46weci89Nzqu4 .loopText,#mermaid-svg-JjO46weci89Nzqu4 .loopText>tspan{fill:#000;stroke:none}#mermaid-svg-JjO46weci89Nzqu4 .loopLine{stroke-width:2px;stroke-dasharray:2, 2;stroke:#ccf;fill:#ccf}#mermaid-svg-JjO46weci89Nzqu4 .note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-JjO46weci89Nzqu4 .noteText,#mermaid-svg-JjO46weci89Nzqu4 .noteText>tspan{fill:#000;stroke:none}#mermaid-svg-JjO46weci89Nzqu4 .activation0{fill:#f4f4f4;stroke:#666}#mermaid-svg-JjO46weci89Nzqu4 .activation1{fill:#f4f4f4;stroke:#666}#mermaid-svg-JjO46weci89Nzqu4 .activation2{fill:#f4f4f4;stroke:#666}#mermaid-svg-JjO46weci89Nzqu4 .mermaid-main-font{font-family:"trebuchet ms", verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-JjO46weci89Nzqu4 .section{stroke:none;opacity:0.2}#mermaid-svg-JjO46weci89Nzqu4 .section0{fill:rgba(102,102,255,0.49)}#mermaid-svg-JjO46weci89Nzqu4 .section2{fill:#fff400}#mermaid-svg-JjO46weci89Nzqu4 .section1,#mermaid-svg-JjO46weci89Nzqu4 .section3{fill:#fff;opacity:0.2}#mermaid-svg-JjO46weci89Nzqu4 .sectionTitle0{fill:#333}#mermaid-svg-JjO46weci89Nzqu4 .sectionTitle1{fill:#333}#mermaid-svg-JjO46weci89Nzqu4 .sectionTitle2{fill:#333}#mermaid-svg-JjO46weci89Nzqu4 .sectionTitle3{fill:#333}#mermaid-svg-JjO46weci89Nzqu4 .sectionTitle{text-anchor:start;font-size:11px;text-height:14px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-JjO46weci89Nzqu4 .grid .tick{stroke:#d3d3d3;opacity:0.8;shape-rendering:crispEdges}#mermaid-svg-JjO46weci89Nzqu4 .grid .tick text{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-JjO46weci89Nzqu4 .grid path{stroke-width:0}#mermaid-svg-JjO46weci89Nzqu4 .today{fill:none;stroke:red;stroke-width:2px}#mermaid-svg-JjO46weci89Nzqu4 .task{stroke-width:2}#mermaid-svg-JjO46weci89Nzqu4 .taskText{text-anchor:middle;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-JjO46weci89Nzqu4 .taskText:not([font-size]){font-size:11px}#mermaid-svg-JjO46weci89Nzqu4 .taskTextOutsideRight{fill:#000;text-anchor:start;font-size:11px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-JjO46weci89Nzqu4 .taskTextOutsideLeft{fill:#000;text-anchor:end;font-size:11px}#mermaid-svg-JjO46weci89Nzqu4 .task.clickable{cursor:pointer}#mermaid-svg-JjO46weci89Nzqu4 .taskText.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-JjO46weci89Nzqu4 .taskTextOutsideLeft.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-JjO46weci89Nzqu4 .taskTextOutsideRight.clickable{cursor:pointer;fill:#003163 !important;font-weight:bold}#mermaid-svg-JjO46weci89Nzqu4 .taskText0,#mermaid-svg-JjO46weci89Nzqu4 .taskText1,#mermaid-svg-JjO46weci89Nzqu4 .taskText2,#mermaid-svg-JjO46weci89Nzqu4 .taskText3{fill:#fff}#mermaid-svg-JjO46weci89Nzqu4 .task0,#mermaid-svg-JjO46weci89Nzqu4 .task1,#mermaid-svg-JjO46weci89Nzqu4 .task2,#mermaid-svg-JjO46weci89Nzqu4 .task3{fill:#8a90dd;stroke:#534fbc}#mermaid-svg-JjO46weci89Nzqu4 .taskTextOutside0,#mermaid-svg-JjO46weci89Nzqu4 .taskTextOutside2{fill:#000}#mermaid-svg-JjO46weci89Nzqu4 .taskTextOutside1,#mermaid-svg-JjO46weci89Nzqu4 .taskTextOutside3{fill:#000}#mermaid-svg-JjO46weci89Nzqu4 .active0,#mermaid-svg-JjO46weci89Nzqu4 .active1,#mermaid-svg-JjO46weci89Nzqu4 .active2,#mermaid-svg-JjO46weci89Nzqu4 .active3{fill:#bfc7ff;stroke:#534fbc}#mermaid-svg-JjO46weci89Nzqu4 .activeText0,#mermaid-svg-JjO46weci89Nzqu4 .activeText1,#mermaid-svg-JjO46weci89Nzqu4 .activeText2,#mermaid-svg-JjO46weci89Nzqu4 .activeText3{fill:#000 !important}#mermaid-svg-JjO46weci89Nzqu4 .done0,#mermaid-svg-JjO46weci89Nzqu4 .done1,#mermaid-svg-JjO46weci89Nzqu4 .done2,#mermaid-svg-JjO46weci89Nzqu4 .done3{stroke:grey;fill:#d3d3d3;stroke-width:2}#mermaid-svg-JjO46weci89Nzqu4 .doneText0,#mermaid-svg-JjO46weci89Nzqu4 .doneText1,#mermaid-svg-JjO46weci89Nzqu4 .doneText2,#mermaid-svg-JjO46weci89Nzqu4 .doneText3{fill:#000 !important}#mermaid-svg-JjO46weci89Nzqu4 .crit0,#mermaid-svg-JjO46weci89Nzqu4 .crit1,#mermaid-svg-JjO46weci89Nzqu4 .crit2,#mermaid-svg-JjO46weci89Nzqu4 .crit3{stroke:#f88;fill:red;stroke-width:2}#mermaid-svg-JjO46weci89Nzqu4 .activeCrit0,#mermaid-svg-JjO46weci89Nzqu4 .activeCrit1,#mermaid-svg-JjO46weci89Nzqu4 .activeCrit2,#mermaid-svg-JjO46weci89Nzqu4 .activeCrit3{stroke:#f88;fill:#bfc7ff;stroke-width:2}#mermaid-svg-JjO46weci89Nzqu4 .doneCrit0,#mermaid-svg-JjO46weci89Nzqu4 .doneCrit1,#mermaid-svg-JjO46weci89Nzqu4 .doneCrit2,#mermaid-svg-JjO46weci89Nzqu4 .doneCrit3{stroke:#f88;fill:#d3d3d3;stroke-width:2;cursor:pointer;shape-rendering:crispEdges}#mermaid-svg-JjO46weci89Nzqu4 .milestone{transform:rotate(45deg) scale(0.8, 0.8)}#mermaid-svg-JjO46weci89Nzqu4 .milestoneText{font-style:italic}#mermaid-svg-JjO46weci89Nzqu4 .doneCritText0,#mermaid-svg-JjO46weci89Nzqu4 .doneCritText1,#mermaid-svg-JjO46weci89Nzqu4 .doneCritText2,#mermaid-svg-JjO46weci89Nzqu4 .doneCritText3{fill:#000 !important}#mermaid-svg-JjO46weci89Nzqu4 .activeCritText0,#mermaid-svg-JjO46weci89Nzqu4 .activeCritText1,#mermaid-svg-JjO46weci89Nzqu4 .activeCritText2,#mermaid-svg-JjO46weci89Nzqu4 .activeCritText3{fill:#000 !important}#mermaid-svg-JjO46weci89Nzqu4 .titleText{text-anchor:middle;font-size:18px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-JjO46weci89Nzqu4 g.classGroup text{fill:#9370db;stroke:none;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);font-size:10px}#mermaid-svg-JjO46weci89Nzqu4 g.classGroup text .title{font-weight:bolder}#mermaid-svg-JjO46weci89Nzqu4 g.clickable{cursor:pointer}#mermaid-svg-JjO46weci89Nzqu4 g.classGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-JjO46weci89Nzqu4 g.classGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-JjO46weci89Nzqu4 .classLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.5}#mermaid-svg-JjO46weci89Nzqu4 .classLabel .label{fill:#9370db;font-size:10px}#mermaid-svg-JjO46weci89Nzqu4 .relation{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-JjO46weci89Nzqu4 .dashed-line{stroke-dasharray:3}#mermaid-svg-JjO46weci89Nzqu4 #compositionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-JjO46weci89Nzqu4 #compositionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-JjO46weci89Nzqu4 #aggregationStart{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-JjO46weci89Nzqu4 #aggregationEnd{fill:#ECECFF;stroke:#9370db;stroke-width:1}#mermaid-svg-JjO46weci89Nzqu4 #dependencyStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-JjO46weci89Nzqu4 #dependencyEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-JjO46weci89Nzqu4 #extensionStart{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-JjO46weci89Nzqu4 #extensionEnd{fill:#9370db;stroke:#9370db;stroke-width:1}#mermaid-svg-JjO46weci89Nzqu4 .commit-id,#mermaid-svg-JjO46weci89Nzqu4 .commit-msg,#mermaid-svg-JjO46weci89Nzqu4 .branch-label{fill:lightgrey;color:lightgrey;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-JjO46weci89Nzqu4 .pieTitleText{text-anchor:middle;font-size:25px;fill:#000;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-JjO46weci89Nzqu4 .slice{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-JjO46weci89Nzqu4 g.stateGroup text{fill:#9370db;stroke:none;font-size:10px;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-JjO46weci89Nzqu4 g.stateGroup text{fill:#9370db;fill:#333;stroke:none;font-size:10px}#mermaid-svg-JjO46weci89Nzqu4 g.statediagram-cluster .cluster-label text{fill:#333}#mermaid-svg-JjO46weci89Nzqu4 g.stateGroup .state-title{font-weight:bolder;fill:#000}#mermaid-svg-JjO46weci89Nzqu4 g.stateGroup rect{fill:#ECECFF;stroke:#9370db}#mermaid-svg-JjO46weci89Nzqu4 g.stateGroup line{stroke:#9370db;stroke-width:1}#mermaid-svg-JjO46weci89Nzqu4 .transition{stroke:#9370db;stroke-width:1;fill:none}#mermaid-svg-JjO46weci89Nzqu4 .stateGroup .composit{fill:white;border-bottom:1px}#mermaid-svg-JjO46weci89Nzqu4 .stateGroup .alt-composit{fill:#e0e0e0;border-bottom:1px}#mermaid-svg-JjO46weci89Nzqu4 .state-note{stroke:#aa3;fill:#fff5ad}#mermaid-svg-JjO46weci89Nzqu4 .state-note text{fill:black;stroke:none;font-size:10px}#mermaid-svg-JjO46weci89Nzqu4 .stateLabel .box{stroke:none;stroke-width:0;fill:#ECECFF;opacity:0.7}#mermaid-svg-JjO46weci89Nzqu4 .edgeLabel text{fill:#333}#mermaid-svg-JjO46weci89Nzqu4 .stateLabel text{fill:#000;font-size:10px;font-weight:bold;font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family)}#mermaid-svg-JjO46weci89Nzqu4 .node circle.state-start{fill:black;stroke:black}#mermaid-svg-JjO46weci89Nzqu4 .node circle.state-end{fill:black;stroke:white;stroke-width:1.5}#mermaid-svg-JjO46weci89Nzqu4 #statediagram-barbEnd{fill:#9370db}#mermaid-svg-JjO46weci89Nzqu4 .statediagram-cluster rect{fill:#ECECFF;stroke:#9370db;stroke-width:1px}#mermaid-svg-JjO46weci89Nzqu4 .statediagram-cluster rect.outer{rx:5px;ry:5px}#mermaid-svg-JjO46weci89Nzqu4 .statediagram-state .divider{stroke:#9370db}#mermaid-svg-JjO46weci89Nzqu4 .statediagram-state .title-state{rx:5px;ry:5px}#mermaid-svg-JjO46weci89Nzqu4 .statediagram-cluster.statediagram-cluster .inner{fill:white}#mermaid-svg-JjO46weci89Nzqu4 .statediagram-cluster.statediagram-cluster-alt .inner{fill:#e0e0e0}#mermaid-svg-JjO46weci89Nzqu4 .statediagram-cluster .inner{rx:0;ry:0}#mermaid-svg-JjO46weci89Nzqu4 .statediagram-state rect.basic{rx:5px;ry:5px}#mermaid-svg-JjO46weci89Nzqu4 .statediagram-state rect.divider{stroke-dasharray:10,10;fill:#efefef}#mermaid-svg-JjO46weci89Nzqu4 .note-edge{stroke-dasharray:5}#mermaid-svg-JjO46weci89Nzqu4 .statediagram-note rect{fill:#fff5ad;stroke:#aa3;stroke-width:1px;rx:0;ry:0}:root{--mermaid-font-family: '"trebuchet ms", verdana, arial';--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive}#mermaid-svg-JjO46weci89Nzqu4 .error-icon{fill:#522}#mermaid-svg-JjO46weci89Nzqu4 .error-text{fill:#522;stroke:#522}#mermaid-svg-JjO46weci89Nzqu4 .edge-thickness-normal{stroke-width:2px}#mermaid-svg-JjO46weci89Nzqu4 .edge-thickness-thick{stroke-width:3.5px}#mermaid-svg-JjO46weci89Nzqu4 .edge-pattern-solid{stroke-dasharray:0}#mermaid-svg-JjO46weci89Nzqu4 .edge-pattern-dashed{stroke-dasharray:3}#mermaid-svg-JjO46weci89Nzqu4 .edge-pattern-dotted{stroke-dasharray:2}#mermaid-svg-JjO46weci89Nzqu4 .marker{fill:#333}#mermaid-svg-JjO46weci89Nzqu4 .marker.cross{stroke:#333}
:root { --mermaid-font-family: "trebuchet ms", verdana, arial;}
#mermaid-svg-JjO46weci89Nzqu4 {
color: rgba(0, 0, 0, 0.75);
font: ;
}
shutdown()
shutdownnow()
running
shutdown
阻塞队列清空,剩下任务执行完成
stop
阻塞队列清空,剩下任务终止
tidying
terminated
线程池分类
ThreadPoolExecutor
newCachedThreadPoolnewFixedThreadPoolnewSingleThreadExecutor
ScheduledThreadPoolExecutor
newScheduledThreadPoolnewSingleScheduledThreadExecutor
ForkJoinPool
newWorkStealingPool
线程池排队策略
Direct Handoffs (e.g. SynchronouseQueue)
读写互锁,只有写入才能读取,读取才能写入需避免设置最大线程池大小,否则,容易导致拒绝新提交任务在处理一系列具有内部依赖关系的请求时,可以避免锁定
Unbounded queues (e.g. LinkedBlockingQueue)
无限制队列,线程池中的线程不会超过核心线程池大小适用于任务相互独立,比如web请求,排队的速度超过处理的速度
Bounded queues(e.g. ArrayBlockingQueue)
通过设置有限的线程来避免资源被耗尽需要同时考虑队列和线程池大小,控制、调优相对来说比较困难大队列,小线程池可能导致较低的吞吐量;较小队列,通常需要较大的线程池,从而增加线程调度负担,也会影响吞吐量
线程池拒绝策略
当Executor处于shutdown状态或者已经超出最大线程池大小,将使用reject策略,拒绝策略分为四类:
中止策略(AbortPolicy)调用者运行策略(CallerRunsPolicy)丢弃策略(DiscardPolicy)丢弃最老的任务策略(DiscardOldestPolicy)
线程池终止(Finalization)
线程池不再使用,并且没有线程(含核心线程),将自动终止如果想在不调用shutdown的情况下,不再使用的线程池自动终止,需要设置allowCoreThreadTimeOut
阻塞队列
ArrayBlockingQueue
LinkedBlockingQueue
DelayQueue
PriorityQueue
SynchronouseQueue