synchronization fixes

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2386 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent 328f9859a5
commit 7fbba41962

@ -200,6 +200,7 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
} }
public void flushCacheSome() { public void flushCacheSome() {
synchronized (ramCache) { ramCache.shiftK2W(); }
int flushCount = ramCache.wSize() / 350; int flushCount = ramCache.wSize() / 350;
if (flushCount > 80) flushCount = 80; if (flushCount > 80) flushCount = 80;
if (flushCount < 20) flushCount = Math.min(20, ramCache.wSize()); if (flushCount < 20) flushCount = Math.min(20, ramCache.wSize());
@ -209,7 +210,6 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
public void flushCache(int count) { public void flushCache(int count) {
if (count <= 0) return; if (count <= 0) return;
synchronized (ramCache) { synchronized (ramCache) {
ramCache.shiftK2W();
busyCacheFlush = true; busyCacheFlush = true;
String wordHash; String wordHash;
System.out.println("DEBUG-Started flush of " + count + " entries from RAM to DB"); System.out.println("DEBUG-Started flush of " + count + " entries from RAM to DB");
@ -418,7 +418,7 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
return size; return size;
} }
public synchronized void close(int waitingBoundSeconds) { public void close(int waitingBoundSeconds) {
synchronized (ramCache) { synchronized (ramCache) {
ramCache.close(waitingBoundSeconds); ramCache.close(waitingBoundSeconds);
if (useCollectionIndex) collections.close(-1); if (useCollectionIndex) collections.close(-1);
@ -427,7 +427,7 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
} }
} }
public synchronized indexContainer deleteContainer(String wordHash) { public indexContainer deleteContainer(String wordHash) {
synchronized (ramCache) { synchronized (ramCache) {
indexContainer c = ramCache.deleteContainer(wordHash); indexContainer c = ramCache.deleteContainer(wordHash);
if (c == null) c = new indexRowSetContainer(wordHash); if (c == null) c = new indexRowSetContainer(wordHash);
@ -479,7 +479,7 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
public static final int RL_WORDFILES = 3; // (to be) outdated structure public static final int RL_WORDFILES = 3; // (to be) outdated structure
public synchronized TreeSet indexContainerSet(String startHash, int resourceLevel, boolean rot, int count) throws IOException { public TreeSet indexContainerSet(String startHash, int resourceLevel, boolean rot, int count) throws IOException {
// creates a set of indexContainers // creates a set of indexContainers
kelondroOrder containerOrder = new indexContainerOrder((kelondroOrder) indexOrder.clone()); kelondroOrder containerOrder = new indexContainerOrder((kelondroOrder) indexOrder.clone());
containerOrder.rotate(startHash.getBytes()); containerOrder.rotate(startHash.getBytes());

Loading…
Cancel
Save