Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) Before the crawler retries to download a URL it checks if the server is already doing a shutdown

theliea9a992f05f2
diff --git a/source/de/anomic/plasma/plasmaCrawlWorker.java b/source/de/anomic/plasma/plasmaCrawlWorker.java
index 49ddd13a5..a9bdec5f2 100644
--- a/source/de/anomic/plasma/plasmaCrawlWorker.java
+++ b/source/de/anomic/plasma/plasmaCrawlWorker.java
@@ -369,12 +369,20 @@ public final class plasmaCrawlWorker extends Thread {
URL redirectionUrl = new URL(url, (String) res.responseHeader.get(httpHeader.LOCATION));
// returning the used httpc
- httpc.returnInstance(remote);
+ httpc.returnInstance(remote);
remote = null;
// restart crawling with new url
- log.logInfo("Redirection detected ('" + res.status + "') for URL " + url.toString() +
+ log.logInfo("CRAWLER Redirection detected ('" + res.status + "') for URL " + url.toString() +
"\nRedirecting request to: " + redirectionUrl);
+
+ // if we are already doing a shutdown we don't need to retry crawling
+ if (Thread.currentThread().isInterrupted()) {
+ log.logError("CRAWLER Retry of URL=" + url.toString() + " aborted because of server shutdown.");
+ return;
+ }
+
+ // retry crawling with new url
load(redirectionUrl,
name,
referer,
@@ -425,8 +433,21 @@ public final class plasmaCrawlWorker extends Thread {
}
- if (retryCrawling) {
+ if (retryCrawling) {
+ // if we are already doing a shutdown we don't need to retry crawling
+ if (Thread.currentThread().isInterrupted()) {
+ log.logError("CRAWLER Retry of URL=" + url.toString() + " aborted because of server shutdown.");
+ return;
+ }
+
+ // returning the used httpc
+ httpc.returnInstance(remote);
+ remote = null;
+
+ // setting the retry counter to 1
if (crawlingRetryCount > 1) crawlingRetryCount = 1;
+
+ // retry crawling
load(url,
name,
referer,