Skip to content

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

added missing blacklist dht cache storage (maybe due to mistakes in cherry picking)

Michael Peter Christen4ee6fb1de9c8
diff --git a/source/net/yacy/repository/Blacklist.java b/source/net/yacy/repository/Blacklist.java
index f993f8739..7675d7ada 100644
--- a/source/net/yacy/repository/Blacklist.java
+++ b/source/net/yacy/repository/Blacklist.java
@@ -54,7 +54,7 @@ import net.yacy.kelondro.util.SetTools;
public class Blacklist {
- private static final File BLACKLIST_DHT_CACHEFILE = new File("DATA/WORK/BlacklistCache_DHT.ser");
+ private static final File BLACKLIST_DHT_CACHEFILE = new File("DATA/WORK/blacklistCache_DHT.ser");
public enum BlacklistType {
DHT, CRAWLER, PROXY, SEARCH, SURFTIPS, NEWS;
@@ -119,6 +119,20 @@ public class Blacklist {
}
}
+ /**
+ * Close (shutdown) this "sub-system", add more here for shutdown.
+ *
+ * @return void
+ */
+ public synchronized void close() {
+ Log.logFine("Blacklist", "Shutting down blacklists ...");
+
+ // Save DHT cache
+ saveDHTCache();
+
+ Log.logFine("Blacklist", "All blacklists has been shutdown.");
+ }
+
public final void setRootPath(final File rootPath) {
if (rootPath == null) {
throw new NullPointerException("The blacklist root path must not be null.");
@@ -531,8 +545,7 @@ public class Blacklist {
final ObjectInputStream in = new ObjectInputStream(new FileInputStream(BLACKLIST_DHT_CACHEFILE));
this.cachedUrlHashs.put(BlacklistType.DHT, (HandleSet) in.readObject());
in.close();
- } else {
- this.cachedUrlHashs.put(BlacklistType.DHT, new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0));
+ return;
}
} catch (final ClassNotFoundException e) {
Log.logException(e);
@@ -541,5 +554,6 @@ public class Blacklist {
} catch (final IOException e) {
Log.logException(e);
}
+ this.cachedUrlHashs.put(BlacklistType.DHT, new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0));
}
}
diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.java
index 195f38266..c811cb26c 100644
--- a/source/net/yacy/search/Switchboard.java
+++ b/source/net/yacy/search/Switchboard.java
@@ -1600,6 +1600,7 @@ public final class Switchboard extends serverSwitch
this.tables.close();
Domains.close();
AccessTracker.dumpLog(new File("DATA/LOG/queries.log"));
+ Switchboard.urlBlacklist.close();
UPnP.deletePortMapping();
this.tray.remove();
try {