public synchronized void stop(boolean immediate) throws InterruptedException {
  if (shutdown)   return;
  if (!immediate && parallelStore != null)   parallelStore.insertStopEvent();
  for (  SingleThreadStageTask task : tasks) {
    Thread stageThread=threadMap.remove(task.getName());
    if (stageThread != null) {
      try {
        if (immediate || parallelStore == null) {
          task.cancel();
          stageThread.interrupt();
          task.execShutdownHooks(stage.getPluginContext());
          stageThread.join();
        }
 else         stageThread.join();
      }
 catch (      InterruptedException e) {
        logger.warn("Interrupted while waiting for stage thread to exit");
      }
    }
  }
  if (threadMap.size() == 0) {
    shutdown=true;
  }
}

public synchronized void stop ( boolean immediate ) throws InterruptedException { if ( shutdown ) return ; if ( ! immediate && parallelStore != null ) parallelStore . insertStopEvent ( ) ; for ( SingleThreadStageTask task : tasks ) { Thread stageThread = threadMap . remove ( task . getName ( ) ) ; if ( stageThread != null ) { try { if ( immediate || parallelStore == null ) { task . cancel ( ) ; stageThread . interrupt ( ) ; task . execShutdownHooks ( stage . getPluginContext ( ) ) ; stageThread . join ( ) ; } else stageThread . join ( ) ; } catch ( InterruptedException e ) { logger . warn ( "Interrupted while waiting for stage thread to exit" ) ; } } } if ( threadMap . size ( ) == 0 ) { shutdown = true ; } }
stop all tasks in the group .
