java.util.concurrent.ThreadPoolExecutor strange logic

Posted by rodrigoap on Stack Overflow See other posts from Stack Overflow or by rodrigoap
Published on 2010-03-23T15:06:37Z Indexed on 2010/03/23 15:13 UTC
Read the original article Hit count: 309

Filed under:
|

Look ath this method of ThreadPoolExcecutor:

public void execute(Runnable command) {
    ...
        if (runState == RUNNING && workQueue.offer(command)) {
            if (runState != RUNNING || poolSize == 0)
                ensureQueuedTaskHandled(command);
        }
    ...
}

It check that runState is RUNNING and then the oposite. As I'm trying to do some tuning on a SEDA like model I wanted to understand the internals of the thread pool.
Do you think this code is correct?

© Stack Overflow or respective owner

Related posts about java

Related posts about threads