Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

move startup time from old serverCore to switchboard (most used here) to make servercore eventually obsolete.

reger665e12f88e8f
diff --git a/source/net/yacy/http/servlets/YaCyDefaultServlet.java b/source/net/yacy/http/servlets/YaCyDefaultServlet.java
index 9b9703fbc..7eb2eb16d 100644
--- a/source/net/yacy/http/servlets/YaCyDefaultServlet.java
+++ b/source/net/yacy/http/servlets/YaCyDefaultServlet.java
@@ -895,7 +895,7 @@ public class YaCyDefaultServlet extends HttpServlet {
// add the application version, the uptime and the client name to every rewrite table
templatePatterns.put(servletProperties.PEER_STAT_VERSION, yacyBuildProperties.getVersion());
- templatePatterns.put(servletProperties.PEER_STAT_UPTIME, ((System.currentTimeMillis() - serverCore.startupTime) / 1000) / 60); // uptime in minutes
+ templatePatterns.put(servletProperties.PEER_STAT_UPTIME, ((System.currentTimeMillis() - sb.startupTime) / 1000) / 60); // uptime in minutes
templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTNAME, sb.peers.mySeed().getName());
templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTID, sb.peers.myID());
templatePatterns.put(servletProperties.PEER_STAT_MYTIME, GenericFormatter.SHORT_SECOND_FORMATTER.format());
diff --git a/source/net/yacy/peers/Network.java b/source/net/yacy/peers/Network.java
index 305e63bdc..00e90f95a 100644
--- a/source/net/yacy/peers/Network.java
+++ b/source/net/yacy/peers/Network.java
@@ -89,11 +89,6 @@ public class Network
// class variables
Switchboard sb;
- public static int yacyTime() {
- // the time since startup of yacy in seconds
- return Math.max(0, (int) ((System.currentTimeMillis() - serverCore.startupTime) / 1000));
- }
-
public Network(final Switchboard sb) {
final long time = System.currentTimeMillis();
diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.java
index 773afccf2..f21a90c5a 100644
--- a/source/net/yacy/search/Switchboard.java
+++ b/source/net/yacy/search/Switchboard.java
@@ -194,7 +194,6 @@ import net.yacy.search.ranking.RankingProfile;
import net.yacy.search.schema.CollectionConfiguration;
import net.yacy.search.schema.CollectionSchema;
import net.yacy.search.schema.WebgraphConfiguration;
-import net.yacy.server.serverCore;
import net.yacy.server.serverSwitch;
import net.yacy.server.http.RobotsTxtConfig;
import net.yacy.utils.CryptoLib;
@@ -281,6 +280,7 @@ public final class Switchboard extends serverSwitch {
public boolean useTailCache;
public boolean exceed134217727;
+ public final long startupTime = System.currentTimeMillis();
private final Semaphore shutdownSync = new Semaphore(0);
private boolean terminate = false;
private boolean startupAction = true; // this is set to false after the first event
@@ -3607,22 +3607,22 @@ public final class Switchboard extends serverSwitch {
}
public float averageQPM() {
- final long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;
+ final long uptime = (System.currentTimeMillis() - this.startupTime) / 1000;
return (this.searchQueriesRobinsonFromRemote + this.searchQueriesGlobal) * 60f / Math.max(uptime, 1f);
}
public float averageQPMGlobal() {
- final long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;
+ final long uptime = (System.currentTimeMillis() - this.startupTime) / 1000;
return (this.searchQueriesGlobal) * 60f / Math.max(uptime, 1f);
}
public float averageQPMPrivateLocal() {
- final long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;
+ final long uptime = (System.currentTimeMillis() - this.startupTime) / 1000;
return (this.searchQueriesRobinsonFromLocal) * 60f / Math.max(uptime, 1f);
}
public float averageQPMPublicLocal() {
- final long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;
+ final long uptime = (System.currentTimeMillis() - this.startupTime) / 1000;
return (this.searchQueriesRobinsonFromRemote) * 60f / Math.max(uptime, 1f);
}
@@ -3632,7 +3632,7 @@ public final class Switchboard extends serverSwitch {
this.peers.mySeed().put(Seed.PORT, getConfig("port", "8090"));
//the speed of indexing (pages/minute) of the peer
- final long uptime = (System.currentTimeMillis() - serverCore.startupTime) / 1000;
+ final long uptime = (System.currentTimeMillis() - this.startupTime) / 1000;
Seed mySeed = this.peers.mySeed();
mySeed.put(Seed.ISPEED, Integer.toString(currentPPM()));
diff --git a/source/net/yacy/server/serverCore.java b/source/net/yacy/server/serverCore.java
index 5da152543..f02bd4934 100644
--- a/source/net/yacy/server/serverCore.java
+++ b/source/net/yacy/server/serverCore.java
@@ -37,7 +37,6 @@ public final class serverCore {
public static final byte[] CRLF = {CR, LF};
public static final String CRLF_STRING = UTF8.String(CRLF);
public static final String LF_STRING = UTF8.String(new byte[]{LF});
- public static final long startupTime = System.currentTimeMillis();
public static boolean useStaticIP = false;