Skip to content

Commit

Permalink
removed most synchronization in wordIndex (for testing)
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2420 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Aug 18, 2006
1 parent 0187c60 commit f5720cb
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions source/de/anomic/plasma/plasmaWordIndex.java
Expand Up @@ -182,22 +182,18 @@ public void flushControl() {

public indexContainer addEntry(String wordHash, indexEntry entry, long updateTime, boolean dhtCase) {
indexContainer c;
synchronized (ramCache) {
if ((c = ramCache.addEntry(wordHash, entry, updateTime, dhtCase)) == null) {
if (!dhtCase) flushControl();
return null;
}
}
return c;
}

public indexContainer addEntries(indexContainer entries, long updateTime, boolean dhtCase) {
synchronized (ramCache) {
indexContainer added = ramCache.addEntries(entries, updateTime, dhtCase);
// force flush
if (!dhtCase) flushControl();
return added;
}
}

public void flushCacheSome() {
Expand Down Expand Up @@ -322,7 +318,6 @@ public int addPageIndex(URL url, String urlHash, Date urlModified, int size, pla
public indexContainer getContainer(String wordHash, boolean deleteIfEmpty, long maxTime) {
long start = System.currentTimeMillis();

synchronized (ramCache) {
// get from cache
indexContainer container = ramCache.getContainer(wordHash, true, -1);

Expand Down Expand Up @@ -356,7 +351,6 @@ public indexContainer getContainer(String wordHash, boolean deleteIfEmpty, long
}
container.add(backend.getContainer(wordHash, deleteIfEmpty, (maxTime < 0) ? -1 : maxTime), -1);
return container;
}
}

public Set getContainers(Set wordHashes, boolean deleteIfEmpty, boolean interruptIfEmpty, long maxTime) {
Expand All @@ -365,7 +359,6 @@ public Set getContainers(Set wordHashes, boolean deleteIfEmpty, boolean interrup
HashSet containers = new HashSet();
String singleHash;
indexContainer singleContainer;
synchronized (ramCache) {
Iterator i = wordHashes.iterator();
long start = System.currentTimeMillis();
long remaining;
Expand All @@ -386,7 +379,6 @@ public Set getContainers(Set wordHashes, boolean deleteIfEmpty, boolean interrup

containers.add(singleContainer);
}
}
return containers;
}

Expand Down Expand Up @@ -425,28 +417,23 @@ public void close(int waitingBoundSeconds) {
}

public indexContainer deleteContainer(String wordHash) {
synchronized (ramCache) {
indexContainer c = ramCache.deleteContainer(wordHash);
if (c == null) c = new indexRowSetContainer(wordHash);
if (useCollectionIndex) c.add(collections.deleteContainer(wordHash), -1);
c.add(assortmentCluster.deleteContainer(wordHash), -1);
c.add(backend.deleteContainer(wordHash), -1);
return c;
}
}

public boolean removeEntry(String wordHash, String urlHash, boolean deleteComplete) {
synchronized (ramCache) {
if (ramCache.removeEntry(wordHash, urlHash, deleteComplete)) return true;
if (useCollectionIndex) {if (collections.removeEntry(wordHash, urlHash, deleteComplete)) return true;}
if (assortmentCluster.removeEntry(wordHash, urlHash, deleteComplete)) return true;
return backend.removeEntry(wordHash, urlHash, deleteComplete);
}
}

public int removeEntries(String wordHash, Set urlHashes, boolean deleteComplete) {
int removed = 0;
synchronized (ramCache) {
removed += ramCache.removeEntries(wordHash, urlHashes, deleteComplete);
if (removed == urlHashes.size()) return removed;
if (useCollectionIndex) {
Expand All @@ -456,7 +443,6 @@ public int removeEntries(String wordHash, Set urlHashes, boolean deleteComplete)
removed += assortmentCluster.removeEntries(wordHash, urlHashes, deleteComplete);
if (removed == urlHashes.size()) return removed;
removed += backend.removeEntries(wordHash, urlHashes, deleteComplete);
}
return removed;
}

Expand All @@ -465,9 +451,7 @@ public int tryRemoveURLs(String urlHash) {
// urlHash assigned. This can only work if the entry is really fresh
// and can be found in the RAM cache
// this returns the number of deletion that had been possible
synchronized (ramCache) {
return ramCache.tryRemoveURLs(urlHash);
}
}

public static final int RL_RAMCACHE = 0;
Expand All @@ -481,7 +465,6 @@ public TreeSet indexContainerSet(String startHash, int resourceLevel, boolean ro
kelondroOrder containerOrder = new indexContainerOrder((kelondroOrder) indexOrder.clone());
containerOrder.rotate(startHash.getBytes());
TreeSet containers = new TreeSet(containerOrder);
synchronized (ramCache) {
Iterator i = wordContainers(startHash, resourceLevel, rot);
if (resourceLevel == plasmaWordIndex.RL_RAMCACHE) count = Math.min(ramCache.wSize(), count);
indexContainer container;
Expand All @@ -492,7 +475,6 @@ public TreeSet indexContainerSet(String startHash, int resourceLevel, boolean ro
count--;
}
}
}
return containers;
}

Expand Down

0 comments on commit f5720cb

Please sign in to comment.