Skip to content

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

fixed a bug which prevented crawl starts after a network switch

Michael Peter Christen926d28dd3f41
diff --git a/source/net/yacy/crawler/data/CrawlQueues.java b/source/net/yacy/crawler/data/CrawlQueues.java
index 28eba0a9c..42583cfa1 100644
--- a/source/net/yacy/crawler/data/CrawlQueues.java
+++ b/source/net/yacy/crawler/data/CrawlQueues.java
@@ -89,17 +89,22 @@ public class CrawlQueues {
this.noticeURL = new NoticedURL(queuePath, sb.useTailCache, sb.exceed134217727);
this.errorURL = new ErrorCache(sb.index.fulltext());
this.delegatedURL = new ConcurrentHashMap<String, DigestURL>();
-
}
+ /**
+ * Relocation is necessary if the user switches the network.
+ * Because this object is part of the scheduler we cannot simply close that object and create a new one.
+ * Instead, the 'living' content of this object is destroyed.
+ * @param newQueuePath
+ */
public void relocate(final File newQueuePath) {
- close();
-
+ // removed pending requests
+ this.workerQueue.clear();
+ this.errorURL.clearCache();
this.remoteCrawlProviderHashes.clear();
-
+ this.noticeURL.close();
this.noticeURL = new NoticedURL(newQueuePath, this.sb.useTailCache, this.sb.exceed134217727);
- this.errorURL = new ErrorCache(this.sb.index.fulltext());
- this.delegatedURL = new ConcurrentHashMap<String, DigestURL>();
+ this.delegatedURL.clear();
}
public synchronized void close() {
diff --git a/source/net/yacy/search/index/ErrorCache.java b/source/net/yacy/search/index/ErrorCache.java
index 9fec1047e..3e7780cab 100644
--- a/source/net/yacy/search/index/ErrorCache.java
+++ b/source/net/yacy/search/index/ErrorCache.java
@@ -78,8 +78,12 @@ public class ErrorCache {
}
}
- public void clear() throws IOException {
+ public void clearCache() {
if (this.cache != null) synchronized (this.cache) {this.cache.clear();}
+ }
+
+ public void clear() throws IOException {
+ clearCache();
this.fulltext.getDefaultConnector().deleteByQuery(CollectionSchema.failreason_s.getSolrFieldName() + AbstractSolrConnector.CATCHALL_DTERM);
}