Implement emergency break in index receive when the limit of the ramCache is exceeded by more than cacheLimit

See: http://www.yacy-forum.de/viewtopic.php?p=22911#22911



git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2248 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
hermens 19 years ago
parent e40987ecab
commit 53cbcc6d6e

@ -99,6 +99,12 @@ public final class transferRWI {
granted = false; // don't accept more words if there are too many words to flush
result = "busy";
pause = 60000;
} else if (checkLimit && sb.wordIndex.wSize() > (sb.wordIndex.getMaxWordCount() + cachelimit)) {
// we are too busy flushing the ramCache to receive indexes
sb.getLog().logInfo("Rejecting RWIs from peer " + otherPeerName + ". We are too busy (wordcachesize=" + sb.wordIndex.wSize() + ").");
granted = false; // don't accept more words if there are too many words to flush
result = "busy";
pause = 300000;
} else {
// we want and can receive indexes
// log value status (currently added to find outOfMemory error
@ -186,4 +192,4 @@ public final class transferRWI {
// return rewrite properties
return prop;
}
}
}

@ -149,6 +149,10 @@ public final class plasmaWordIndex extends indexAbstractRI implements indexRI {
ramCache.setMaxWordCount(maxWords);
}
public int getMaxWordCount() {
return ramCache.getMaxWordCount();
}
public void flushControl() {
// check for forced flush
synchronized (this) { ramCache.shiftK2W(); }

Loading…
Cancel
Save