Beispiel #1
0
  private void startIteration(String cursorString) {
    //        if (cursorString == null) {
    //            CSVEntry entry = CSVCache.getInstance().getCSV(csvId);
    //            if (entry != null) {
    //                if (entry.getStatus() == CSVEntry.BUILDING_STATUS) {
    //                    return;
    //                }
    //            }
    //        }
    CSVEntry entry = CSVCache.getInstance().getCSV(csvId);

    if (entry != null) {
      PersistenceManager pm = PMF.get().getPersistenceManager();
      try {
        ResponseList rl = ResponseManager.getResponse(runId, 0l, null, cursorString);
        entry = processResponses(pm, rl.getResponses());
        if (!(rl.getResponses().isEmpty() || rl.getResumptionToken() == null)) {
          new CSVGeneration(rl.getResumptionToken(), runId, csvId).scheduleTask();
        } else {
          entry.setStatus(CSVEntry.FINISHED_STATUS);
        }
        CSVCache.getInstance().putCSV(csvId, entry);
      } finally {
        pm.close();
      }
    }
  }
Beispiel #2
0
  public CSVEntry firstIteration() {
    csvId = UUID.randomUUID().toString();
    PersistenceManager pm = PMF.get().getPersistenceManager();
    try {
      ResponseList rl = ResponseManager.getResponse(runId, 0l, null, cursorString);
      CSVEntry entry = processResponses(pm, rl.getResponses());
      if (!(rl.getResponses().isEmpty() || rl.getResumptionToken() == null)) {
        new CSVGeneration(rl.getResumptionToken(), runId, csvId).scheduleTask();
      } else {
        entry.setStatus(CSVEntry.FINISHED_STATUS);
      }

      CSVCache.getInstance().putCSV(csvId, entry);
      return entry;
    } finally {
      pm.close();
    }
  }