看ATH ThreadPoolExcecutor的这种方法:java.util.concurrent.ThreadPoolExecutor中的奇怪的逻辑
public void execute(Runnable command) {
...
if (runState == RUNNING && workQueue.offer(command)) {
if (runState != RUNNING || poolSize == 0)
ensureQueuedTaskHandled(command);
}
...
}
它检查runState
为RUNNING
,然后oposite。正如我试图对SEDA模型进行一些调整,我想了解线程池的内部。
你认为这段代码是正确的吗?