add run time in version info

This commit is contained in:
heavyrain2012
2021-09-20 21:01:40 +08:00
parent f39fd3abd5
commit 4fd87eb605
2 changed files with 11 additions and 3 deletions
@@ -80,6 +80,7 @@ public class Server {
}
private ServerAcceptor m_acceptor;
private long startTime;
private boolean m_shutdowning = false;
@@ -102,6 +103,10 @@ public class Server {
System.out.println(BANNER);
}
public Server() {
startTime = System.currentTimeMillis();
}
public static void start(String[] args) throws IOException {
instance = new Server();
final IConfig config = defaultConfig();
@@ -513,4 +518,7 @@ public class Server {
public ThreadPoolExecutorWrapper getCallbackScheduler() {
return callbackScheduler;
}
public long getRunTime() {
return (System.currentTimeMillis() - startTime)/1000;
}
}
@@ -8,6 +8,8 @@
package win.liyufan.im;
import io.moquette.server.Server;
import java.io.*;
import java.util.Properties;
@@ -34,10 +36,8 @@ public class GitRepositoryState {
public final String buildTime;
public final String buildHost;
public final String buildVersion;
public final long runTime;
private final static long startTime = System.currentTimeMillis();
private GitRepositoryState(Properties properties) {
this.tags = String.valueOf(properties.get("git.tags"));
@@ -62,7 +62,7 @@ public class GitRepositoryState {
this.buildTime = String.valueOf(properties.get("git.build.time"));
this.buildHost = String.valueOf(properties.get("git.build.host"));
this.buildVersion = String.valueOf(properties.get("git.build.version"));
this.runTime = (System.currentTimeMillis() - startTime)/1000;
this.runTime = Server.getServer().getRunTime();
}
public static GitRepositoryState getGitRepositoryState() throws IOException {