@Override public boolean onRestart(Scheduler.RestartTopologyRequest request){
  int containerId=request.getContainerIndex();
  List<Process> processesToRestart=new LinkedList<>();
  if (containerId == -1) {
    LOG.info("Command to restart the entire topology: " + LocalContext.topologyName(config));
    processesToRestart.addAll(processToContainer.keySet());
  }
 else {
    LOG.info("Command to restart a container of topology: " + LocalContext.topologyName(config));
    LOG.info("Restart container requested: " + containerId);
    for (    Process p : processToContainer.keySet()) {
      if (containerId == processToContainer.get(p)) {
        processesToRestart.add(p);
      }
    }
  }
  if (processesToRestart.isEmpty()) {
    LOG.severe("Container not exist.");
    return false;
  }
  for (  Process process : processesToRestart) {
    process.destroy();
  }
  return true;
}

@ Override public boolean onRestart ( Scheduler . RestartTopologyRequest request ) { int containerId = request . getContainerIndex ( ) ; List < Process > processesToRestart = new LinkedList < > ( ) ; if ( containerId == - 1 ) { LOG . info ( "Command to restart the entire topology: " + LocalContext . topologyName ( config ) ) ; processesToRestart . addAll ( processToContainer . keySet ( ) ) ; } else { LOG . info ( "Command to restart a container of topology: " + LocalContext . topologyName ( config ) ) ; LOG . info ( "Restart container requested: " + containerId ) ; for ( Process p : processToContainer . keySet ( ) ) { if ( containerId == processToContainer . get ( p ) ) { processesToRestart . add ( p ) ; } } } if ( processesToRestart . isEmpty ( ) ) { LOG . severe ( "Container not exist." ) ; return false ; } for ( Process process : processesToRestart ) { process . destroy ( ) ; } return true ; }
handler to restart topology
