Exemple #1
0
  /**
   * Wait untill will not be empty for timeout
   *
   * @param timeout
   * @throws InterruptedException
   */
  public void join(long timeout) throws InterruptedException {
    SWTTeslaActivator.debugLog("UIJobCollector is going to join");
    long startTime = System.currentTimeMillis();
    // Context ctx = ContextManagement.currentContext();
    while (true) {
      removeCanceledJobs();
      long delta = System.currentTimeMillis() - startTime;
      if (delta > timeout) {
        break;
      }
      if (isJoinEmpty()) {
        break;
      }

      List<Job> jobs2 = getJobs();
      for (Job job : jobs2) {
        SWTTeslaActivator.debugLog("Waiting for job:" + job.getName() + " " + job.getState());
      }
      SWTTeslaActivator.debugLog("UIJobCollector is going to join");
      Thread.sleep(50);
    }
  }