question: private void processWorkerExit ( Worker w , boolean completedAbruptly ) { if ( completedAbruptly ) decrementWorkerCount ( ) ; final ReentrantLock mainLock = this . mainLock ; mainLock . lock ( ) ; try { completedTaskCount += w . completedTasks ; workers . remove ( w ) ; } finally { mainLock . unlock ( ) ; } tryTerminate2 ( ) ; if ( ! completedAbruptly ) { int min = allowCoreThreadTimeOut ? 0 : corePoolSize ; if ( min == 0 && ! workQueue . isEmpty ( ) ) min = 1 ; int c = ctl . get ( ) ; if ( workerCountOf ( c ) >= min || runStateOf ( c ) >= STOP ) return ; } addWorker ( null , false ) ; }
target:  Performs cleanup and bookkeeping for a dying worker. Called only from worker threads. Unless completedAbruptly is set, assumes that workerCount has already been adjusted to account for exit.  This method removes thread from worker set, and possibly terminates the pool or replaces the worker if either it exited due to user task exception or if fewer than corePoolSize workers are running or queue is non-empty but there are no workers.