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 { 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 { public enum BlacklistType {
DHT, CRAWLER, PROXY, SEARCH, SURFTIPS, NEWS; 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) { public final void setRootPath(final File rootPath) {
if (rootPath == null) { if (rootPath == null) {
throw new NullPointerException("The blacklist root path must not be 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)); final ObjectInputStream in = new ObjectInputStream(new FileInputStream(BLACKLIST_DHT_CACHEFILE));
this.cachedUrlHashs.put(BlacklistType.DHT, (HandleSet) in.readObject()); this.cachedUrlHashs.put(BlacklistType.DHT, (HandleSet) in.readObject());
in.close(); in.close();
} else { return;
this.cachedUrlHashs.put(BlacklistType.DHT, new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0));
} }
} catch (final ClassNotFoundException e) { } catch (final ClassNotFoundException e) {
Log.logException(e); Log.logException(e);
@ -541,5 +554,6 @@ public class Blacklist {
} catch (final IOException e) { } catch (final IOException e) {
Log.logException(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(); this.tables.close();
Domains.close(); Domains.close();
AccessTracker.dumpLog(new File("DATA/LOG/queries.log")); AccessTracker.dumpLog(new File("DATA/LOG/queries.log"));
Switchboard.urlBlacklist.close();
UPnP.deletePortMapping(); UPnP.deletePortMapping();
this.tray.remove(); this.tray.remove();
try { try {

Loading…
Cancel
Save