Skip to content

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

fixed bad remote crawl behavior

orbitercdbbfd50fbc8
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java
index 451a9eacb..8d967a6e8 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -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;
}
diff --git a/source/de/anomic/plasma/plasmaWordIndexDistribution.java b/source/de/anomic/plasma/plasmaWordIndexDistribution.java
index 45ecb9535..79eeed837 100644
--- a/source/de/anomic/plasma/plasmaWordIndexDistribution.java
+++ b/source/de/anomic/plasma/plasmaWordIndexDistribution.java
@@ -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);