Skip to content

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

fix for deadlock

orbiter0575f128381e
diff --git a/source/de/anomic/crawler/CrawlQueues.java b/source/de/anomic/crawler/CrawlQueues.java
index 9e47ced54..5d26c2e9a 100644
--- a/source/de/anomic/crawler/CrawlQueues.java
+++ b/source/de/anomic/crawler/CrawlQueues.java
@@ -83,10 +83,12 @@ public class CrawlQueues {
delegatedURL = new ZURL(plasmaPath, "urlDelegated3.db", true);
}
+ /**
+ * tests if hash occurrs in any database
+ * @param hash
+ * @return if the hash exists, the name of the database is returned, otherwise null is returned
+ */
public String urlExists(final String hash) {
- // tests if hash occurrs in any database
- // if it exists, the name of the database is returned,
- // if it not exists, null is returned
if (delegatedURL.exists(hash)) return "delegated";
if (errorURL.exists(hash)) return "errors";
for (final crawlWorker worker: workers.values()) {
diff --git a/source/de/anomic/crawler/CrawlStacker.java b/source/de/anomic/crawler/CrawlStacker.java
index 3afc4fcd4..51bb2778f 100644
--- a/source/de/anomic/crawler/CrawlStacker.java
+++ b/source/de/anomic/crawler/CrawlStacker.java
@@ -254,9 +254,9 @@ public final class CrawlStacker {
}
// check if the url is double registered
- final String dbocc = nextQueue.urlExists(entry.url().hash());
- if (dbocc != null || indexSegment.urlMetadata().exists(entry.url().hash())) {
- final URLMetadataRow oldEntry = indexSegment.urlMetadata().load(entry.url().hash(), null, 0);
+ final String dbocc = nextQueue.urlExists(entry.url().hash()); // returns the name of the queue if entry exists
+ URLMetadataRow oldEntry = null;
+ if (dbocc != null || (oldEntry = indexSegment.urlMetadata().load(entry.url().hash(), null, 0)) != null) {
final boolean recrawl = (oldEntry != null) && (profile.recrawlIfOlder() > oldEntry.loaddate().getTime());
// do double-check
if ((dbocc != null) && (!recrawl)) {
diff --git a/source/de/anomic/crawler/CrawlSwitchboard.java b/source/de/anomic/crawler/CrawlSwitchboard.java
index 6ac52521f..b3811873b 100644
--- a/source/de/anomic/crawler/CrawlSwitchboard.java
+++ b/source/de/anomic/crawler/CrawlSwitchboard.java
@@ -30,7 +30,6 @@ import java.io.File;
import java.io.IOException;
import java.util.Iterator;
-import de.anomic.crawler.CrawlProfile.entry;
import de.anomic.document.Word;
import de.anomic.kelondro.util.FileUtils;
import de.anomic.kelondro.util.kelondroException;
diff --git a/source/de/anomic/kelondro/text/ReferenceContainerOrder.java b/source/de/anomic/kelondro/text/ReferenceContainerOrder.java
index e129f324e..f09f1d2c5 100644
--- a/source/de/anomic/kelondro/text/ReferenceContainerOrder.java
+++ b/source/de/anomic/kelondro/text/ReferenceContainerOrder.java
@@ -76,7 +76,6 @@ public class ReferenceContainerOrder<ReferenceType extends Reference> extends Ab
return this.embeddedOrder.cardinal(key);
}
- @SuppressWarnings("unchecked")
public boolean equals(final Order<ReferenceContainer<ReferenceType>> otherOrder) {
if (!(otherOrder instanceof ReferenceContainerOrder)) return false;
return this.embeddedOrder.equals(((ReferenceContainerOrder<ReferenceType>) otherOrder).embeddedOrder);