From f9063e2040b57827af9b6adbf5042fca49432853 Mon Sep 17 00:00:00 2001 From: orbiter Date: Mon, 20 Feb 2006 00:06:03 +0000 Subject: [PATCH] added some synchronization to avoid that several tasks can trigger a cache flush simultanously git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1708 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/plasma/plasmaWordIndex.java | 6 +++--- source/de/anomic/plasma/plasmaWordIndexDistribution.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java index 543a4b703..93af2cf02 100644 --- a/source/de/anomic/plasma/plasmaWordIndex.java +++ b/source/de/anomic/plasma/plasmaWordIndex.java @@ -139,7 +139,7 @@ public final class plasmaWordIndex { return added; } - private void flushCacheToBackend(String wordHash) { + private synchronized void flushCacheToBackend(String wordHash) { plasmaWordIndexEntryContainer c = ramCache.deleteContainer(wordHash); plasmaWordIndexEntryContainer feedback = assortmentCluster.storeTry(wordHash, c); if (feedback != null) { @@ -188,7 +188,7 @@ public final class plasmaWordIndex { return ((long) microDateDays) * ((long) day); } - public int addPageIndex(URL url, String urlHash, Date urlModified, int size, plasmaCondenser condenser, String language, char doctype) { + public synchronized int addPageIndex(URL url, String urlHash, Date urlModified, int size, plasmaCondenser condenser, String language, char doctype) { // this is called by the switchboard to put in a new page into the index // use all the words in one condenser object to simultanous create index entries @@ -330,7 +330,7 @@ public final class plasmaWordIndex { backend.close(10); } - public void deleteIndex(String wordHash) { + public synchronized void deleteIndex(String wordHash) { ramCache.deleteContainer(wordHash); assortmentCluster.removeFromAll(wordHash, -1); backend.deleteIndex(wordHash); diff --git a/source/de/anomic/plasma/plasmaWordIndexDistribution.java b/source/de/anomic/plasma/plasmaWordIndexDistribution.java index ab76ad736..9dab724d9 100644 --- a/source/de/anomic/plasma/plasmaWordIndexDistribution.java +++ b/source/de/anomic/plasma/plasmaWordIndexDistribution.java @@ -195,7 +195,7 @@ public final class plasmaWordIndexDistribution { return -1; } - // send away the indexes to all these indexes + // send away the indexes to all these peers String peerNames = ""; int hc1 = 0; plasmaDHTTransfer transfer = null;