Skip to content

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

small refactoring to prepare for new queues

orbiter024744245c93
diff --git a/source/de/anomic/crawler/CrawlSwitchboard.java b/source/de/anomic/crawler/CrawlSwitchboard.java
index 4e74e5b95..e93d0bf6d 100644
--- a/source/de/anomic/crawler/CrawlSwitchboard.java
+++ b/source/de/anomic/crawler/CrawlSwitchboard.java
@@ -134,7 +134,7 @@ public final class CrawlSwitchboard {
", " + profilesPassiveFile.length()/1024);
// init queues
- this.queuePreStack = new IndexingStack(peers, new File(queuesRoot, "urlNoticePreStack.stack"), this.profilesActiveCrawls);
+ this.queuePreStack = new IndexingStack(peers, queuesRoot, "urlNoticePreStack.stack", this.profilesActiveCrawls);
}
public void clear() {
diff --git a/source/de/anomic/crawler/IndexingStack.java b/source/de/anomic/crawler/IndexingStack.java
index c915ddb98..47b1aa19b 100644
--- a/source/de/anomic/crawler/IndexingStack.java
+++ b/source/de/anomic/crawler/IndexingStack.java
@@ -51,7 +51,11 @@ import de.anomic.yacy.yacyURL;
import de.anomic.yacy.logging.Log;
public class IndexingStack {
-
+
+ private static final byte[] zbytes = new byte[0];
+ //private static final String queuesPrefix = "indexing";
+ //private static final String sbQueueName = "sbQueueStack";
+
protected final CrawlProfile profiles;
protected final RecordStack sbQueueStack;
protected final yacySeedDB peers;
@@ -59,12 +63,13 @@ public class IndexingStack {
public IndexingStack(
final yacySeedDB peers,
- final File sbQueueStackPath,
+ final File queuesRoot,
+ final String sbQueueStackName,
final CrawlProfile profiles) {
this.profiles = profiles;
this.peers = peers;
this.queueInProcess = new ConcurrentHashMap<String, QueueEntry>();
- this.sbQueueStack = RecordStack.open(sbQueueStackPath, rowdef);
+ this.sbQueueStack = RecordStack.open(new File(queuesRoot, sbQueueStackName), rowdef);
}
public static final Row rowdef = new Row(
@@ -92,12 +97,12 @@ public class IndexingStack {
if (sbQueueStack == null) return; // may occur during shutdown
sbQueueStack.push(sbQueueStack.row().newEntry(new byte[][]{
entry.url.toString().getBytes(),
- (entry.referrerHash == null) ? "".getBytes() : entry.referrerHash.getBytes(),
+ (entry.referrerHash == null) ? zbytes : entry.referrerHash.getBytes(),
Base64Order.enhancedCoder.encodeLong((entry.ifModifiedSince == null) ? 0 : entry.ifModifiedSince.getTime(), 11).getBytes(),
new byte[]{entry.flags},
- (entry.initiator == null) ? "".getBytes() : entry.initiator.getBytes(),
+ (entry.initiator == null) ? zbytes : entry.initiator.getBytes(),
Base64Order.enhancedCoder.encodeLong(entry.depth, rowdef.width(5)).getBytes(),
- (entry.profileHandle == null) ? "".getBytes() : entry.profileHandle.getBytes(),
+ (entry.profileHandle == null) ? zbytes : entry.profileHandle.getBytes(),
(entry.anchorName == null) ? "-".getBytes("UTF-8") : entry.anchorName.getBytes("UTF-8")
}));
}
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java
index 62fa8c141..325d0c99f 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -1262,7 +1262,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch<IndexingStack.
if (crawler.queuePreStack.size() == sizeBefore) {
// this is a severe problem: because this time a null is returned, it means that this status will last forever
// to re-enable use of the sbQueue, it must be emptied completely
- log.logSevere("deQueue: does not shrink after pop() == null. Emergency reset of " + crawler.queuePreStack.file());
+ log.logSevere("deQueue: does not shrink after pop() == null. Emergency reset of sbQueue");
crawler.queuePreStack.clear();
}
return null;