public static < T extends IncrementalTask > void runJob ( List < T > initialTasks , ShardedJobController < T > controller ) { List < T > results = new ArrayList <> ( ) ; for ( T task : initialTasks ) { Preconditions . checkNotNull ( task , "Null initial task: %s" , initialTasks ) ; task . prepare ( ) ; do { task . run ( ) ; } while ( ! task . isDone ( ) ) ; task . cleanup ( ) ; results . add ( task ) ; } controller . completed ( results . iterator ( ) ) ; }
Runs the given job and returns its result .