@ Override public void workerPreempted ( final String id ) { final Optional < Collection < Tasklet > > preemptedTasklets = runningWorkers . removeWorker ( id ) ; if ( preemptedTasklets . isPresent ( ) ) { for ( final Tasklet tasklet : preemptedTasklets . get ( ) ) { pendingTasklets . addFirst ( tasklet ) ; } } }
Remove the worker from runningWorkers and add back the lost tasklets to pendingTasklets .