Ejemplo n.º 1
0
    void killProcess(RunningProcess process) {
      try {
        Runtime.getRuntime().exec(getKillCommand(process));
      } catch (IOException e) {
        throw new RuntimeException(e);
      }

      final long time = System.currentTimeMillis() + TIMEOUT;
      do {
        List<RunningProcess> runningProcesses = processUtil.getRunningProcesses();
        if (processUtil.getProcessById(runningProcesses, process.getProcessId()) == null) {
          return;
        }
        try {
          Thread.sleep(200);
        } catch (InterruptedException e) {
          throw new RuntimeException(e);
        }
      } while (System.currentTimeMillis() < time);

      Assert.fail("Did not kill process " + process + " " + processUtil.getRunningProcesses());
    }
Ejemplo n.º 2
0
 private List<RunningProcess> waitForAllProcesses() throws Exception {
   final long time = System.currentTimeMillis() + TIMEOUT;
   List<RunningProcess> runningProcesses;
   do {
     runningProcesses = processUtil.getRunningProcesses();
     if (processUtil.containsProcesses(
         runningProcesses, HOST_CONTROLLER, SERVER_ONE, SERVER_TWO)) {
       return runningProcesses;
     }
     Thread.sleep(200);
   } while (System.currentTimeMillis() < time);
   Assert.fail("Did not have all running processes " + runningProcesses);
   return null;
 }
Ejemplo n.º 3
0
 private List<RunningProcess> waitForAllProcesses(Set<String> excludedProcessIds)
     throws Exception {
   final long time = System.currentTimeMillis() + TIMEOUT;
   List<RunningProcess> runningProcesses;
   do {
     runningProcesses = processUtil.getRunningProcesses();
     for (Iterator<RunningProcess> it = runningProcesses.iterator(); it.hasNext(); ) {
       RunningProcess proc = it.next();
       if (excludedProcessIds.contains(proc.getProcessId())) {
         it.remove();
       }
     }
     if (processUtil.containsProcesses(
         runningProcesses, HOST_CONTROLLER, SERVER_ONE, SERVER_TWO)) {
       return runningProcesses;
     }
     Thread.sleep(200);
   } while (System.currentTimeMillis() < time);
   Assert.fail("Did not have all running processes " + runningProcesses);
   return null;
 }