HER-1756 improved crawl status reporting: more definitive start-after-setup, conclusion-after-logging of crawling

* AbstractFrontier.java
    call new finalTasks just before announcing FINISH state
* WorkQueueFrontier.java
    eliminate closeQueue
* BdbFrontier.java
    move dumpAllPendingToLog from closeQueue (triggered by CrawlController FINISHED) to finalTasks (before Frontier FINISH)
    replace closeQueue with close() override
This commit is contained in:
gojomo
2010-04-13 02:10:56 +00:00
parent 8be7be2983
commit a82838cd27
3 changed files with 25 additions and 5 deletions
@@ -408,6 +408,7 @@ public abstract class AbstractFrontier
// continue to process discovered and finished URIs
inbound.take().process();
}
finalTasks();
// TODO: more cleanup?
reachedState(State.FINISH);
break loop;
@@ -435,6 +436,14 @@ public abstract class AbstractFrontier
}
/**
* Perform any tasks necessary before entering
* FINISH frontier state/FINISHED crawl state
*/
protected void finalTasks() {
// by default; nothing
}
/**
* Fill the outbound queue with eligible CrawlURIs, to capacity
* or as much as possible.
@@ -181,7 +181,13 @@ implements Checkpointable, BeanNameAware {
}
}
protected void closeQueue() {
/* (non-Javadoc)
* @see org.archive.crawler.frontier.AbstractFrontier#finalTasks()
*/
@Override
protected void finalTasks() {
super.finalTasks();
// before closing/releasing, dump if requested
if (getDumpPendingAtClose()) {
try {
@@ -190,7 +196,15 @@ implements Checkpointable, BeanNameAware {
logger.log(Level.WARNING, "dump pending problem", e);
}
}
}
/* (non-Javadoc)
* @see org.archive.crawler.frontier.WorkQueueFrontier#close()
*/
@Override
public void close() {
ArchiveUtils.closeQuietly(pendingUris);
super.close();
}
protected BdbMultipleWorkQueues getWorkQueues() {
@@ -312,8 +312,7 @@ implements Closeable,
* Release resources only needed when running
*/
public void close() {
ArchiveUtils.closeQuietly(uriUniqFilter);
closeQueue();
ArchiveUtils.closeQuietly(uriUniqFilter);
ArchiveUtils.closeQuietly(allQueues);
}
@@ -1551,8 +1550,6 @@ implements Closeable,
}
}
protected abstract void closeQueue();
/**
* Returns <code>true</code> if the WorkQueue implementation of this
* Frontier stores its workload on disk instead of relying