From 143fa40d773553c3eea23468d13e6aea99a969dd Mon Sep 17 00:00:00 2001 From: orbiter Date: Wed, 3 Oct 2007 15:34:16 +0000 Subject: [PATCH] fix for http://forum.yacy-websuche.de/viewtopic.php?f=6&t=394&p=2382#p2382 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4135 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/index/indexRAMRI.java | 3 ++- source/de/anomic/plasma/plasmaWordIndex.java | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/de/anomic/index/indexRAMRI.java b/source/de/anomic/index/indexRAMRI.java index 06d869567..573f97efd 100644 --- a/source/de/anomic/index/indexRAMRI.java +++ b/source/de/anomic/index/indexRAMRI.java @@ -392,7 +392,8 @@ public final class indexRAMRI implements indexRI { } public synchronized indexContainer getContainer(String wordHash, Set urlselection) { - + if (wordHash == null) return null; + // retrieve container indexContainer container = (indexContainer) cache.get(wordHash); diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java index b1adbf3a5..ad5a9db54 100644 --- a/source/de/anomic/plasma/plasmaWordIndex.java +++ b/source/de/anomic/plasma/plasmaWordIndex.java @@ -192,13 +192,12 @@ public final class plasmaWordIndex implements indexRI { } private void flushCache(indexRAMRI ram, int count) { - if (ram.size() <= count) count = ram.size(); - if (count <= 0) return; - if (count > 5000) count = 5000; busyCacheFlush = true; String wordHash; ArrayList containerList = new ArrayList(); synchronized (ram) { + count = Math.min(5000, Math.min(count, ram.size())); + if (count <= 0) return; boolean collectMax = true; indexContainer c; while (collectMax) {