Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
added pause option to server threads. The pause is started by calling intermission(Long.MAX_VALUE) and can be stopped by calling intermission(0)
orbiter018b3e0832b1
diff --git a/source/de/anomic/server/serverAbstractThread.java b/source/de/anomic/server/serverAbstractThread.javaindex 99651cd0a..f8f009983 100644--- a/source/de/anomic/server/serverAbstractThread.java+++ b/source/de/anomic/server/serverAbstractThread.java@@ -175,7 +175,10 @@ public abstract class serverAbstractThread extends Thread implements serverThrea}public void intermission(long pause) {- this.intermission = System.currentTimeMillis() + pause;+ if (pause == Long.MAX_VALUE)+ this.intermission = Long.MAX_VALUE;+ else+ this.intermission = System.currentTimeMillis() + pause;}public void terminate(boolean waitFor) {@@ -245,15 +248,25 @@ public abstract class serverAbstractThread extends Thread implements serverThreaRuntime rt = Runtime.getRuntime();while (running) {- if ((this.intermissionObedient) && (this.intermission > 0)) {+ if ((this.intermissionObedient) && (this.intermission > 0) && (this.intermission != Long.MAX_VALUE)) {long itime = this.intermission - System.currentTimeMillis();- if (itime > 0) {- logSystem("thread '" + this.getName() + "' breaks for intermission: " + (itime / 1000) + " seconds");- ratz(itime);- }- this.intermission = 0;- }- if (rt.freeMemory() > memprereq) try {+ if (itime > 0) {+ if (itime > this.idlePause) itime = this.idlePause;+ logSystem("thread '" + this.getName()+ + "' breaks for intermission: " + (itime / 1000)+ + " seconds");+ ratz(itime);+ }+ this.intermission = 0;+ }++ if (this.intermission == Long.MAX_VALUE) {+ // omit Job, paused+ logSystem("thread '" + this.getName() + "' paused");+ timestamp = System.currentTimeMillis();+ ratz(this.idlePause);+ idletime += System.currentTimeMillis() - timestamp;+ } else if (rt.freeMemory() > memprereq) try {// do jobtimestamp = System.currentTimeMillis();memstamp0 = serverMemory.used();