fixed bad remote crawl behavior

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@453 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 20 years ago
parent f32d8bdfa8
commit cdbbfd50fb

@ -529,6 +529,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
wordIndex.close(waitingBoundSeconds);
log.logSystem("SWITCHBOARD SHUTDOWN STEP 3: sending termination signal to database manager");
try {
indexDistribution.close();
cacheLoader.close();
wikiDB.close();
messageDB.close();
@ -736,6 +737,19 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
} catch (IOException e) {}
}
if (sbQueue.size() >= indexingSlots) {
log.logDebug("LimitCrawl: too many processes in indexing queue, dismissed to protect emergency case (" +
"sbQueueSize=" + sbQueue.size() + ")");
return false;
}
if (cacheLoader.size() >= crawlSlots) {
log.logDebug("LimitCrawl: too many processes in loader queue, dismissed to protect emergency case (" +
"cacheLoader=" + cacheLoader.size() + ")");
return false;
}
// if the server is busy, we do crawling more slowly
//if (!(cacheManager.idle())) try {Thread.currentThread().sleep(2000);} catch (InterruptedException e) {}
@ -779,18 +793,6 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
if (success) return true;
}
// alternatively do a local crawl
if (sbQueue.size() >= indexingSlots) {
log.logDebug("LimitCrawl: too many processes in indexing queue, dismissed (" +
"sbQueueSize=" + sbQueue.size() + ")");
return false;
}
if (cacheLoader.size() >= crawlSlots) {
log.logDebug("LimitCrawl: too many processes in loader queue, dismissed (" +
"cacheLoader=" + cacheLoader.size() + ")");
return false;
}
processLocalCrawling(urlEntry, profile, stats);
return true;
}

@ -28,6 +28,7 @@ public class plasmaWordIndexDistribution {
private plasmaWordIndex wordIndex;
private serverLog log;
private boolean enabled;
private boolean closed;
public plasmaWordIndexDistribution(plasmaURLPool urlPool, plasmaWordIndex wordIndex, serverLog log,
boolean enable) {
@ -35,6 +36,7 @@ public class plasmaWordIndexDistribution {
this.wordIndex = wordIndex;
this.enabled = enable;
this.log = log;
this.closed = false;
setCounts(100 /*indexCount*/, 1 /*juniorPeerCount*/, 3 /*seniorPeerCount*/, 8000);
}
@ -46,8 +48,16 @@ public class plasmaWordIndexDistribution {
enabled = false;
}
public void close() {
closed = true;
}
public boolean job() {
if (this.closed) {
log.logDebug("no word distribution: closed");
return false;
}
if (yacyCore.seedDB == null) {
log.logDebug("no word distribution: seedDB == null");
return false;
@ -131,6 +141,10 @@ public class plasmaWordIndexDistribution {
String error;
String peerNames = "";
while ((e.hasMoreElements()) && (hc < peerCount)) {
if (closed) {
log.logError("Index distribution interrupted by close, nothing deleted locally.");
return -1; // interrupted
}
seed = (yacySeed) e.nextElement();
if (seed != null) {
error = yacyClient.transferIndex(seed, indexEntities, urlPool.loadedURL);

Loading…
Cancel
Save