mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-11-09 23:43:29 +00:00
[HER-1607] handle persist state when crawl starts up
* BdbModule.java
fail-fast if not started properly; stop with fewer errors in problem situations
* CrawlController.java
continue past runtimeException on stop
* CrawlJob.java
less redundant error-reporting
* AbstractFrontier.java
consider PAUSE or FINISH valid targets after unexpected exception
* StatisticsTracker.java
avoid promoting runtimeException in report-generating up
* PersistOnlineProcessor.java
delegate DB-closing to BdbModule to avoid double-close
This commit is contained in:
1 parent
d5e088ed6a
commit
163dcb7826
6 files changed
+34
-20
No files matched your search
@@ -26,6 +26,7 @@ import java.io.PrintWriter;
|
||||
import java.io.Serializable;
|
||||
import java.io.StringWriter;
|
||||
import java.util.LinkedList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.archive.crawler.event.CrawlStateEvent;
|
||||
@@ -368,7 +369,11 @@ implements Serializable,
|
||||
|
||||
LOGGER.fine("Finished crawl.");
|
||||
|
||||
appCtx.stop();
|
||||
try {
|
||||
appCtx.stop();
|
||||
} catch (RuntimeException re) {
|
||||
LOGGER.log(Level.SEVERE,re.getMessage(),re);
|
||||
}
|
||||
// Ok, now we are ready to exit.
|
||||
sendCrawlStateChangeEvent(State.FINISHED, this.sExit);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,10 @@ import org.xml.sax.SAXException;
|
||||
*
|
||||
* @contributor gojomo
|
||||
*/
|
||||
public class CrawlJob implements Comparable<CrawlJob>, ApplicationListener{
|
||||
public class CrawlJob implements Comparable<CrawlJob>, ApplicationListener {
|
||||
private final static Logger LOGGER =
|
||||
Logger.getLogger(CrawlJob.class.getName());
|
||||
|
||||
File primaryConfig;
|
||||
PathSharingContext ac;
|
||||
int launchCount;
|
||||
@@ -401,7 +404,10 @@ public class CrawlJob implements Comparable<CrawlJob>, ApplicationListener{
|
||||
Thread launcher = new Thread(alertThreadGroup, getShortName()+" launchthread") {
|
||||
public void run() {
|
||||
startContext();
|
||||
getCrawlController().requestCrawlStart();
|
||||
CrawlController cc = getCrawlController();
|
||||
if(cc!=null) {
|
||||
cc.requestCrawlStart();
|
||||
}
|
||||
}
|
||||
};
|
||||
getJobLogger().log(Level.INFO,"Job launched");
|
||||
@@ -426,8 +432,7 @@ public class CrawlJob implements Comparable<CrawlJob>, ApplicationListener{
|
||||
ac = null;
|
||||
beansException(be);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(System.err);
|
||||
getJobLogger().log(Level.SEVERE,e.getMessage(),e);
|
||||
LOGGER.log(Level.SEVERE,e.getClass().getSimpleName()+": "+e.getMessage(),e);
|
||||
try {
|
||||
ac.close();
|
||||
} catch (Exception e2) {
|
||||
|
||||
@@ -566,7 +566,7 @@ public abstract class AbstractFrontier
|
||||
} catch (RuntimeException e) {
|
||||
// log, try to pause, continue
|
||||
logger.log(Level.SEVERE,"",e);
|
||||
if(targetState!=State.PAUSE) {
|
||||
if(targetState!=State.PAUSE && targetState!=State.FINISH) {
|
||||
requestState(State.PAUSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -896,7 +896,11 @@ public class StatisticsTracker
|
||||
//controller.addOrderToManifest();
|
||||
|
||||
for(Class<Report> reportClass : END_REPORTS) {
|
||||
writeReportFile(reportClass);
|
||||
try {
|
||||
writeReportFile(reportClass);
|
||||
} catch (RuntimeException re) {
|
||||
logger.log(Level.SEVERE, re.getMessage(), re);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user