From 89e7af037a7318ab19a7578cd27d710666526404 Mon Sep 17 00:00:00 2001 From: auron_x Date: Wed, 31 Jan 2007 17:05:15 +0000 Subject: [PATCH] *) used more switchboard-vars instead of config-vars git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3310 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- .../de/anomic/plasma/plasmaSwitchboard.java | 4 ++++ source/de/anomic/yacy/yacyPeerActions.java | 20 +++++++++---------- source/yacy.java | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java index f1da8c08a..073812502 100644 --- a/source/de/anomic/plasma/plasmaSwitchboard.java +++ b/source/de/anomic/plasma/plasmaSwitchboard.java @@ -241,8 +241,12 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser private plasmaDHTChunk dhtTransferChunk = null; public TreeMap localSearches, remoteSearches; public HashMap localSearchTracker, remoteSearchTracker; + public long startupTime = 0; + public long lastseedcheckuptime = -1; public long indexedPages = 0; + public long lastindexedPages = 0; public double requestedQueries = 0d; + public double lastrequestedQueries = 0d; /* * Remote Proxy configuration diff --git a/source/de/anomic/yacy/yacyPeerActions.java b/source/de/anomic/yacy/yacyPeerActions.java index 71df6437e..81730d0f6 100644 --- a/source/de/anomic/yacy/yacyPeerActions.java +++ b/source/de/anomic/yacy/yacyPeerActions.java @@ -109,21 +109,21 @@ public class yacyPeerActions { seedDB.mySeed.put(yacySeed.PORT, Integer.toString(serverCore.getPortNr(sb.getConfig("port", "8080")))); } - long uptime = ((System.currentTimeMillis() - sb.getConfigLong("startupTime", 0)) / 1000); - long uptimediff = uptime - sb.getConfigLong("lastseedcheckUptime", 0); //TODO: Do not use the switchboard? - long indexedcdiff = sb.indexedPages - sb.getConfigLong("lastseedcheckIndexedc", 0); - double requestcdiff = sb.requestedQueries - sb.getConfigDouble("lastseedcheckRequestc", 0d); - if (uptimediff > 300 || sb.getConfigLong("lastseedcheckUptime", -1) == -1 ) { - sb.setConfig("lastseedcheckUptime", uptime); - sb.setConfig("lastseedcheckIndexedc", sb.indexedPages); - sb.setConfig("lastseedcheckRequestc", sb.requestedQueries); + long uptime = (System.currentTimeMillis() - sb.startupTime) / 1000; + long uptimediff = uptime - sb.lastseedcheckuptime; + long indexedcdiff = sb.indexedPages - sb.lastindexedPages; + double requestcdiff = sb.requestedQueries - sb.lastrequestedQueries; + if (uptimediff > 300 || sb.lastseedcheckuptime == -1 ) { + sb.lastseedcheckuptime = uptime; + sb.lastindexedPages = sb.indexedPages; + sb.lastrequestedQueries = sb.requestedQueries; } //the speed of indexing (pages/minute) of the peer seedDB.mySeed.put(yacySeed.ISPEED, Long.toString(Math.round(Math.max((float) indexedcdiff, 0f) * 60f / Math.max((float) uptimediff, 1f)))); - sb.setConfig("totalPPM", Long.toString(sb.indexedPages * 60 / Math.max(uptime, 1))); + sb.setConfig("totalPPM", sb.indexedPages * 60 / Math.max(uptime, 1)); seedDB.mySeed.put(yacySeed.RSPEED, Long.toString(Math.round(Math.max((float) requestcdiff, 0f) * 60f / Math.max((float) uptimediff, 1f)))); - sb.setConfig("totalQPM", Double.toString(sb.requestedQueries * 60d / Math.max((double) uptime, 1d))); + sb.setConfig("totalQPM", sb.requestedQueries * 60d / Math.max((double) uptime, 1d)); seedDB.mySeed.put(yacySeed.UPTIME, Long.toString(uptime/60)); // the number of minutes that the peer is up in minutes/day (moving average MA30) seedDB.mySeed.put(yacySeed.LCOUNT, Integer.toString(sb.wordIndex.loadedURL.size())); // the number of links that the peer has stored (LURL's) diff --git a/source/yacy.java b/source/yacy.java index e37dba90b..0f7aadd14 100644 --- a/source/yacy.java +++ b/source/yacy.java @@ -308,7 +308,7 @@ public final class yacy { sb.setConfig("vString", combined2prettyVersion(Double.toString(version))); sb.setConfig("vdate", vDATE); sb.setConfig("applicationRoot", homePath); - sb.setConfig("startupTime", Long.toString(startup)); + sb.startupTime = startup; serverLog.logConfig("STARTUP", "YACY Version: " + version + ", Built " + vDATE); yacyCore.latestVersion = version;