Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
simplification / speedup of GenerationMemoryStrategy
sixcoolerd3b9349b6f2c
diff --git a/source/net/yacy/kelondro/util/GenerationMemoryStrategy.java b/source/net/yacy/kelondro/util/GenerationMemoryStrategy.javaindex 55b24ea3e..1253537a6 100644--- a/source/net/yacy/kelondro/util/GenerationMemoryStrategy.java+++ b/source/net/yacy/kelondro/util/GenerationMemoryStrategy.java@@ -51,7 +51,7 @@ public class GenerationMemoryStrategy extends MemoryStrategy {*/@Overrideprotected final long free() {- return getUsage(eden, false).getCommitted() - getUsage(eden, false).getUsed();+ return youngAvailable();}/**@@ -61,7 +61,7 @@ public class GenerationMemoryStrategy extends MemoryStrategy {*/@Overrideprotected final long available() {- return available(true);+ return available(false);}/**@@ -70,7 +70,7 @@ public class GenerationMemoryStrategy extends MemoryStrategy {* @return bytes*/private final long available(final boolean force) {- return force & properState(force) ? Math.max(youngAvailable(), oldAvailable()) : Math.min(youngAvailable(), Math.max(M, oldAvailable()));+ return force & properState(force) ? Math.max(youngAvailable(), oldAvailable()) : oldAvailable();}/**@@ -99,6 +99,14 @@ public class GenerationMemoryStrategy extends MemoryStrategy {protected final long maxMemory() {return heap.getHeapMemoryUsage().getMax();}++ /**+ * get the memory that needs to be available for properState+ */+ protected final long minMemory()+ {+ return getUsage(eden, true).getUsed();+ }/*** checks if a specified amount of bytes are available@@ -151,7 +159,7 @@ public class GenerationMemoryStrategy extends MemoryStrategy {* @return if survivor fits into old space*/private boolean properState(final boolean force) {- final long surv = force? Math.max(M, getUsage(survivor, false).getUsed()) : getUsage(survivor, false).getCommitted();+ final long surv = force? M + getUsage(survivor, false).getUsed() : getUsage(survivor, false).getCommitted();return surv < oldAvailable();}diff --git a/source/net/yacy/kelondro/workflow/InstantBusyThread.java b/source/net/yacy/kelondro/workflow/InstantBusyThread.javaindex 1a03b79b5..e8d62ab23 100644--- a/source/net/yacy/kelondro/workflow/InstantBusyThread.java+++ b/source/net/yacy/kelondro/workflow/InstantBusyThread.java@@ -162,7 +162,7 @@ public final class InstantBusyThread extends AbstractBusyThread implements BusyTthread.setIdleSleep(-1);thread.setBusySleep(-1);thread.setMemPreReqisite(0);- thread.setLoadPreReqisite(99); // this is called during initialization phase and some code parts depend on it; therefore we cannot set a prerequisite that prevents the start of that thread+ thread.setLoadPreReqisite(Double.MAX_VALUE); // this is called during initialization phase and some code parts depend on it; therefore we cannot set a prerequisite that prevents the start of that threadthread.start();return thread;}