Пример #1
0
  /**
   * Create a new, runnable duplicate of the job
   *
   * @return the new job
   */
  public Job duplicate() {

    Job j = new Job();

    j.arguments = new ArrayList<String>(arguments);
    j.dbEngine = dbEngine;
    j.dbInstance = dbInstance;
    j.logFile = logFile;

    return j;
  }
Пример #2
0
  /**
   * Find differences in the argument tokens between two or more processes
   *
   * @param jobs the jobs
   * @param ignoreWorkloads true to ignore workload arguments
   * @return the map of difference strings
   */
  public static Map<Job, String> findDiffrenceStrings(
      Collection<Job> jobs, boolean ignoreWorkloads) {

    HashMap<Job, List<String>> tokens = new HashMap<Job, List<String>>();
    for (Job j : jobs) {
      tokens.put(j, j.getArgumentTokens());
    }

    HashMap<Job, String> r = new HashMap<Job, String>();
    for (Job j : jobs) {
      String uniqueTokens = "";
      for (String t : tokens.get(j)) {

        if (ignoreWorkloads) {
          String s = t;
          if (s.startsWith("-")) s = s.substring(1);
          if (s.startsWith("-")) s = s.substring(1);
          int space = s.indexOf(' ');
          if (space > 0) s = s.substring(0, space);
          if (Workload.WORKLOADS.containsKey(s)) continue;
        }

        boolean unique = true;
        for (Job x : jobs) {
          if (x == j) continue;
          if (tokens.get(x).contains(t)) {
            unique = false;
            break;
          }
        }
        if (unique) {
          if (!"".equals(uniqueTokens)) {
            uniqueTokens += " ";
          }
          uniqueTokens += t;
        }
      }
      r.put(j, uniqueTokens);
    }

    return r;
  }