question: private void updateWorkAmount ( double workTime ) { if ( workTime <= 0 ) { currentWorkAmount *= 2 ; } else { totalTimeTaken += workTime ; completedWorkAmount += currentWorkAmount ; currentWorkAmount = ( int ) Math . ceil ( targetExecutionMs * completedWorkAmount / totalTimeTaken ) ; } }
target:  Update the currentWorkAmount based upon the workTime it took to run the last command so running the worker will take ~targetExecutionMs.