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

cherry picking)
pull/1/head
Michael Peter Christen 13 years ago
parent e4d36fa5eb
commit 4ee6fb1de9

@ -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));
}
}

@ -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 {

Loading…
Cancel
Save