fix for HER-2037 final crawl reports written after crawl is "FINISHED" - call dumpReports() in StatisticsTracker.stop() which (since the HER-1954 changes) runs at the right time, after all url processing has finished but before the FINISHED state is officially reached

This commit is contained in:
Noah Levitt
2013-04-22 21:23:43 -07:00
parent 1713093699
commit dafd95eef7
3 changed files with 8 additions and 5 deletions
@@ -321,7 +321,8 @@ implements Serializable,
// suppress duplicate state-reports
return;
}
this.state = newState;
this.state = newState;
LOGGER.fine("reached CrawlController.State " + this.state + ", notifying listeners");
CrawlStateEvent event = new CrawlStateEvent(this,newState,status.getDescription());
appCtx.publishEvent(event);
}
@@ -386,13 +386,14 @@ public abstract class AbstractFrontier
}
break;
case FINISH:
logger.fine("FINISH requested, waiting for in process urls to finish");
// prevent all outbound takes
outboundLock.writeLock().lock();
// process all inbound
while (getInProcessCount()>0) {
Thread.sleep(1000);
}
logger.fine("0 urls in process, running final tasks");
finalTasks();
// TODO: more cleanup?
reachedState(State.FINISH);
@@ -437,6 +438,7 @@ public abstract class AbstractFrontier
*/
protected void reachedState(State justReached) {
if(justReached != lastReachedState) {
logger.fine("reached Frontier.State " + this.lastReachedState + ", notifying listeners");
controller.noteFrontierState(justReached);
lastReachedState = justReached;
}
@@ -338,6 +338,8 @@ public class StatisticsTracker
public void stop() {
isRunning = false;
executor.shutdownNow();
progressStatisticsEvent();
dumpReports();
}
@SuppressWarnings("unchecked")
@@ -560,10 +562,8 @@ public class StatisticsTracker
}
public void crawlEnded(String sExitMessage) {
logNote("CRAWL ENDED - " + sExitMessage);
crawlEndTime = System.currentTimeMillis();
progressStatisticsEvent();
dumpReports();
logNote("CRAWL ENDED - " + sExitMessage);
}
/**