question: private boolean addWorker ( Runnable firstTask , boolean core ) { for ( ; ; ) { int c = ctl . get ( ) ; int rs = runStateOf ( c ) ; if ( rs == SHUTDOWN ) { if ( workQueue . isEmpty ( ) ) return false ; c = ctl . get ( ) ; } int wc = workerCountOf ( c ) ; if ( rs > SHUTDOWN || wc >= CAPACITY || wc >= ( core ? corePoolSize : maximumPoolSize ) ) return false ; if ( ctl . compareAndSet ( c , ctlOf ( rs , wc + 1 ) ) ) break ; } Worker w = new Worker ( firstTask ) ; Thread t = w . thread ; if ( t == null ) { decrementWorkerCount ( ) ; tryTerminate2 ( ) ; return false ; } final ReentrantLock mainLock = this . mainLock ; mainLock . lock ( ) ; try { workers . add ( w ) ; int s = workers . size ( ) ; if ( s > largestPoolSize ) largestPoolSize = s ; } finally { mainLock . unlock ( ) ; } t . start ( ) ; return true ; }
target:  Checks if a new worker can be added with respect to current pool state and the given bound (either core or maximum). If so the worker count is adjusted accordingly, and, if possible, a new worker is created and started running firstTask as its first task, This method returns false if the pool is stopped or eligible to shut down. It also returns false if the thread factory fails to create a thread when asked, which requires a backout of workerCount, and a recheck for termination, in case the existence of this worker was holding up termination.