Skip to content

Commit

Permalink
added some synchronization to avoid that several tasks can trigger a …
Browse files Browse the repository at this point in the history
…cache flush simultanously

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1708 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Feb 20, 2006
1 parent 2c4e4ae commit f9063e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions source/de/anomic/plasma/plasmaWordIndex.java
Expand Up @@ -139,7 +139,7 @@ public int addEntries(plasmaWordIndexEntryContainer entries, long updateTime, bo
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) {
Expand Down Expand Up @@ -188,7 +188,7 @@ public static long reverseMicroDateDays(int microDateDays) {
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

Expand Down Expand Up @@ -330,7 +330,7 @@ public void close(int waitingBoundSeconds) {
backend.close(10);
}

public void deleteIndex(String wordHash) {
public synchronized void deleteIndex(String wordHash) {
ramCache.deleteContainer(wordHash);
assortmentCluster.removeFromAll(wordHash, -1);
backend.deleteIndex(wordHash);
Expand Down
2 changes: 1 addition & 1 deletion source/de/anomic/plasma/plasmaWordIndexDistribution.java
Expand Up @@ -195,7 +195,7 @@ public int performTransferIndex(int indexCount, int peerCount, boolean delete) {
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;
Expand Down

0 comments on commit f9063e2

Please sign in to comment.