move startup time from old serverCore to switchboard (most used here)

to make servercore eventually obsolete.
pull/1/head
reger 11 years ago
parent 336425912a
commit 665e12f88e

@ -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());

@ -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();

@ -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()));

@ -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;

Loading…
Cancel
Save