From 2fbc0696bf985b6ffbe09b5f9b09ba5e7e997c0f Mon Sep 17 00:00:00 2001 From: hermens Date: Fri, 21 Aug 2009 13:10:59 +0000 Subject: [PATCH] Fix for http://forum.yacy-websuche.de/viewtopic.php?f=6&t=2334 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6258 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- .../anomic/kelondro/text/ReferenceContainerCache.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/de/anomic/kelondro/text/ReferenceContainerCache.java b/source/de/anomic/kelondro/text/ReferenceContainerCache.java index 51f2aa529..e5ca3c0dc 100644 --- a/source/de/anomic/kelondro/text/ReferenceContainerCache.java +++ b/source/de/anomic/kelondro/text/ReferenceContainerCache.java @@ -427,8 +427,15 @@ public final class ReferenceContainerCache exte synchronized (cache) { ReferenceContainer containerNew = cache.put(tha, container); if (containerNew == null) return; - container.putAllRecent(containerNew); - cache.put(tha, container); + // Now merge the smaller container into the lager. + // The other way around can become very slow + if (container.size() >= containerNew.size()) { + container.putAllRecent(containerNew); + cache.put(tha, container); + } else { + containerNew.putAllRecent(container); + cache.put(tha, containerNew); + } } }