private void updateWorkAmount(double workTime){
  if (workTime <= 0) {
    currentWorkAmount*=2;
  }
 else {
    totalTimeTaken+=workTime;
    completedWorkAmount+=currentWorkAmount;
    currentWorkAmount=(int)Math.ceil(targetExecutionMs * completedWorkAmount / totalTimeTaken);
  }
}

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