diff --git a/source/de/anomic/index/indexURL.java b/source/de/anomic/index/indexURL.java index 8dc692c19..4030aa5c1 100644 --- a/source/de/anomic/index/indexURL.java +++ b/source/de/anomic/index/indexURL.java @@ -33,6 +33,7 @@ import java.text.SimpleDateFormat; import java.util.HashMap; import de.anomic.kelondro.kelondroBase64Order; +import de.anomic.kelondro.kelondroIndex; import de.anomic.kelondro.kelondroTree; import de.anomic.server.serverCodings; import de.anomic.yacy.yacySeedDB; @@ -405,14 +406,18 @@ public class indexURL { // the class object - protected kelondroTree urlHashCache; + protected kelondroIndex urlHashCache; public indexURL() { urlHashCache = null; } public int size() { - return urlHashCache.size(); + try { + return urlHashCache.size(); + } catch (IOException e) { + return 0; + } } public boolean remove(String hash) { @@ -429,15 +434,18 @@ public class indexURL { } public int cacheNodeChunkSize() { - return urlHashCache.cacheNodeChunkSize(); + if (urlHashCache instanceof kelondroTree) return ((kelondroTree) urlHashCache).cacheNodeChunkSize(); + return 0; } public int[] cacheNodeStatus() { - return urlHashCache.cacheNodeStatus(); + if (urlHashCache instanceof kelondroTree) return ((kelondroTree) urlHashCache).cacheNodeStatus(); + return null; } public String[] cacheObjectStatus() { - return urlHashCache.cacheObjectStatus(); + if (urlHashCache instanceof kelondroTree) return ((kelondroTree) urlHashCache).cacheObjectStatus(); + return null; } diff --git a/source/de/anomic/plasma/plasmaCrawlEURL.java b/source/de/anomic/plasma/plasmaCrawlEURL.java index 6a3912d18..71f238ff5 100644 --- a/source/de/anomic/plasma/plasmaCrawlEURL.java +++ b/source/de/anomic/plasma/plasmaCrawlEURL.java @@ -140,8 +140,9 @@ public class plasmaCrawlEURL extends indexURL { if (cachePath.exists()) try { // open existing cache - urlHashCache = new kelondroTree(cachePath, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent); - urlHashCache.assignRowdef(rowdef); + kelondroTree tree = new kelondroTree(cachePath, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent); + tree.assignRowdef(rowdef); + urlHashCache = tree; } catch (IOException e) { cachePath.delete(); urlHashCache = new kelondroTree(cachePath, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent, rowdef, true); diff --git a/source/de/anomic/plasma/plasmaCrawlLURL.java b/source/de/anomic/plasma/plasmaCrawlLURL.java index bd9398679..1d59a4c5d 100644 --- a/source/de/anomic/plasma/plasmaCrawlLURL.java +++ b/source/de/anomic/plasma/plasmaCrawlLURL.java @@ -115,8 +115,9 @@ public final class plasmaCrawlLURL extends indexURL { if (cachePath.exists()) { // open existing cache try { - urlHashCache = new kelondroTree(cachePath, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent); - urlHashCache.assignRowdef(rowdef); + kelondroTree tree = new kelondroTree(cachePath, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent); + tree.assignRowdef(rowdef); + urlHashCache = tree; } catch (IOException e) { cachePath.getParentFile().mkdirs(); urlHashCache = new kelondroTree(cachePath, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent, rowdef, true); diff --git a/source/de/anomic/plasma/plasmaCrawlNURL.java b/source/de/anomic/plasma/plasmaCrawlNURL.java index 19db11c73..695606298 100644 --- a/source/de/anomic/plasma/plasmaCrawlNURL.java +++ b/source/de/anomic/plasma/plasmaCrawlNURL.java @@ -168,8 +168,9 @@ public class plasmaCrawlNURL extends indexURL { File cacheFile = new File(cacheStacksPath, "urlNotice1.db"); if (cacheFile.exists()) try { // open existing cache - urlHashCache = new kelondroTree(cacheFile, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent); - urlHashCache.assignRowdef(rowdef); + kelondroTree tree = new kelondroTree(cacheFile, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent); + tree.assignRowdef(rowdef); + urlHashCache = tree; } catch (IOException e) { cacheFile.delete(); urlHashCache = new kelondroTree(cacheFile, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent, rowdef, true); @@ -249,15 +250,6 @@ public class plasmaCrawlNURL extends indexURL { plasmaCrawlNURL.this.initThead = null; } } - - /* - private static String normalizeHost(String host) { - if (host.length() > urlHostLength) host = host.substring(0, urlHostLength); - host = host.toLowerCase(); - while (host.length() < urlHostLength) host = host + " "; - return host; - } - */ private static String normalizeHandle(int h) { String d = Integer.toHexString(h); @@ -484,7 +476,6 @@ public class plasmaCrawlNURL extends indexURL { this.flags = new bitfield(urlFlagLength); this.handle = 0; this.stored = false; - store(); } public Entry(String hash) throws IOException {