public synchronized void interuptSetupAgent(int exitCode, String errMesg){
    PrintWriter setupAgentDoneWriter = null;
    PrintWriter setupAgentLogWriter  = null;
    try {
      for (String host : sshHostInfo.getHosts()) {
        File doneFile = new File(requestIdDir, host + BSHostStatusCollector.doneFileFilter);

        // Do not rewrite finished host statuses
        if (!doneFile.exists()) {
          setupAgentDoneWriter = new PrintWriter(doneFile);
          setupAgentDoneWriter.print(exitCode);
          setupAgentDoneWriter.close();
        }

        File logFile = new File(requestIdDir, host + BSHostStatusCollector.logFileFilter);
        if (!logFile.exists()) {
          setupAgentLogWriter = new PrintWriter(logFile);
          setupAgentLogWriter.print("Error while bootstrapping:\n" + errMesg);
          setupAgentLogWriter.close();
        }
      }
    } catch (FileNotFoundException ex) {
      LOG.error(ex.toString());
    } finally {
      if (setupAgentDoneWriter != null) {
        setupAgentDoneWriter.close();
      }

      if (setupAgentLogWriter != null) {
        setupAgentLogWriter.close();
      }
    }    
  }
Calculates bootstrap timeout as a function of number of hosts.
@return timeout in milliseconds
ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java