From 024744245c93c1c58a650ea669e6d53021d9f653 Mon Sep 17 00:00:00 2001 From: orbiter Date: Sat, 4 Jul 2009 12:17:10 +0000 Subject: [PATCH] small refactoring to prepare for new queues git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6173 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/crawler/CrawlSwitchboard.java | 2 +- source/de/anomic/crawler/IndexingStack.java | 17 +++++++++++------ source/de/anomic/plasma/plasmaSwitchboard.java | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) 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(); - 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