public boolean restartJob ( int containerIndex ) { synchronized ( this ) { if ( isTerminated ) { LOG . severe ( "Job has been killed" ) ; return false ; } // List of tasks to restart List < String > tasksToRestart = new ArrayList <> ( ) ; if ( containerIndex == - 1 ) { // Restart all tasks tasksToRestart . addAll ( tasksId . values ( ) ) ; } else { tasksToRestart . add ( tasksId . get ( containerIndex ) ) ; } // Kill the task -- the framework will automatically restart it for ( String taskId : tasksToRestart ) { driver . killTask ( Protos . TaskID . newBuilder ( ) . setValue ( taskId ) . build ( ) ) ; } return true ; } }
Restart a topology