fixed bug that caused deletion of crawl profiles at every application startup

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6240 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 161d2fd2ef
commit c4ae2cd03f

@ -41,6 +41,7 @@ import de.anomic.kelondro.util.FileUtils;
import de.anomic.kelondro.util.kelondroException;
import de.anomic.yacy.yacySeedDB;
import de.anomic.yacy.yacyURL;
import de.anomic.yacy.logging.Log;
public class CrawlProfile {
@ -57,6 +58,12 @@ public class CrawlProfile {
profileTableFile.getParentFile().mkdirs();
final Heap dyn = new Heap(profileTableFile, yacySeedDB.commonHashLength, NaturalOrder.naturalOrder, 1024 * 64);
profileTable = new MapView(dyn, 500, '_');
profileIterator pi = new profileIterator(true);
entry e;
while (pi.hasNext()) {
e = pi.next();
Log.logInfo("CrawlProfiles", "loaded Profile " + e.handle() + ": " + e.name());
}
}
public void clear() {

@ -103,14 +103,7 @@ public final class CrawlSwitchboard {
}
}
initActiveCrawlProfiles();
log.logInfo("Loaded active crawl profiles from file " + profilesActiveFile.getName() +
", " + this.profilesActiveCrawls.size() + " entries");
Iterator<entry> i = this.profilesActiveCrawls.profiles(true);
entry c;
while (i.hasNext()) {
c = i.next();
log.logInfo("active crawl: " + c.handle() + " - " + c.name());
}
log.logInfo("Loaded active crawl profiles from file " + profilesActiveFile.getName() + ", " + this.profilesActiveCrawls.size() + " entries");
final File profilesPassiveFile = new File(queuesRoot, DBFILE_PASSIVE_CRAWL_PROFILES);
if (!profilesPassiveFile.exists()) {
// migrate old file

@ -279,12 +279,12 @@ public class MapView {
}
public synchronized objectIterator entries(final boolean up, final boolean rotating) throws IOException {
return new objectIterator(keys(up, rotating));
public synchronized MapIterator entries(final boolean up, final boolean rotating) throws IOException {
return new MapIterator(keys(up, rotating));
}
public synchronized objectIterator entries(final boolean up, final boolean rotating, final byte[] firstKey, final byte[] secondKey) throws IOException {
return new objectIterator(keys(up, rotating, firstKey, secondKey));
public synchronized MapIterator entries(final boolean up, final boolean rotating, final byte[] firstKey, final byte[] secondKey) throws IOException {
return new MapIterator(keys(up, rotating, firstKey, secondKey));
}
/**
@ -311,14 +311,14 @@ public class MapView {
close();
}
public class objectIterator implements Iterator<Map<String, String>> {
public class MapIterator implements Iterator<Map<String, String>> {
// enumerates Map-Type elements
// the key is also included in every map that is returned; it's key is 'key'
Iterator<byte[]> keyIterator;
boolean finish;
public objectIterator(final Iterator<byte[]> keyIterator) {
public MapIterator(final Iterator<byte[]> keyIterator) {
this.keyIterator = keyIterator;
this.finish = false;
}

@ -626,10 +626,6 @@ public final class Switchboard extends serverAbstractSwitch implements serverSwi
new String[]{"condenseDocument", "CrawlStacker"},
this, "parseDocument", 2 * serverProcessor.useCPU + 1, indexingCondensementProcessor, 2 * serverProcessor.useCPU + 1);
// clean up profiles
this.log.logConfig("Cleaning Profiles");
try { cleanProfiles(); } catch (final InterruptedException e) { /* Ignore this here */ }
// deploy busy threads
log.logConfig("Starting Threads");
MemoryControl.gc(10000, "plasmaSwitchboard, help for profiler"); // help for profiler - thq

Loading…
Cancel
Save