예제 #1
0
 private String startProgress(ContentListingProgress progress) {
   if (progress == null || ContentListingProgress.START.equals(progress)) {
     return "start";
   }
   return String.format(
       "%s %s %s", progress.getCategory(), progress.getPublisher(), progress.getUri());
 }
예제 #2
0
 public void backpopulate(StatusReporter reporter, Boolean dryRun) throws Exception {
   Iterator<Content> contentItr = contentLister.listContent(createListingCriteria());
   AtomicInteger mutatedCounter = new AtomicInteger(0);
   AtomicInteger totalCounter = new AtomicInteger(0);
   while (contentItr.hasNext()) {
     Content content = contentItr.next();
     executor.submit(aliasGeneratingRunnable(content, mutatedCounter, dryRun));
     totalCounter.incrementAndGet();
     if (mutatedCounter.get() % 1000 == 0) {
       reporter.reportStatus(
           String.format(
               "Processed %d total items, added %d aliases",
               totalCounter.get(), mutatedCounter.get()));
       progressStore.storeProgress(TASK_NAME, ContentListingProgress.progressFrom(content));
     }
   }
 }