Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
*) removing buzy waiting *) changing reference to logger
theli1eff96f4715d
diff --git a/source/de/anomic/server/serverAbstractThread.java b/source/de/anomic/server/serverAbstractThread.javaindex f3541ee91..8270845ce 100644--- a/source/de/anomic/server/serverAbstractThread.java+++ b/source/de/anomic/server/serverAbstractThread.java@@ -48,6 +48,8 @@package de.anomic.server;+import de.anomic.server.logging.serverLog;+public abstract class serverAbstractThread extends Thread implements serverThread {private long startup = 0, idlePause = 0, busyPause = 0, blockPause = 0;@@ -144,6 +146,10 @@ public abstract class serverAbstractThread extends Thread implements serverThreapublic void terminate(boolean waitFor) {// after calling this method, the thread shall terminatethis.running = false;++ // interrupting the thread+ this.interrupt();+// wait for terminationif (waitFor) {// Busy waiting removed: while (this.isAlive()) try {this.sleep(100);} catch (InterruptedException e) {break;}@@ -215,13 +221,18 @@ public abstract class serverAbstractThread extends Thread implements serverThrea}private void ratz(long millis) {- int loop = 1;- while (millis > 1000) {- loop = loop * 2;- millis = millis / 2;- }- while ((loop-- > 0) && (running)) {- try {this.sleep(millis);} catch (InterruptedException e) {}+// int loop = 1;+// while (millis > 1000) {+// loop = loop * 2;+// millis = millis / 2;+// }+// while ((loop-- > 0) && (running)) {+// try {this.sleep(millis);} catch (InterruptedException e) {}+// }+ try {+ Thread.sleep(millis);+ } catch (InterruptedException e) {+ if (this.log != null) log.logSystem(this.getName() + " interrupted because of shutdown.");}}