add run time in version info
This commit is contained in:
@@ -80,6 +80,7 @@ public class Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ServerAcceptor m_acceptor;
|
private ServerAcceptor m_acceptor;
|
||||||
|
private long startTime;
|
||||||
|
|
||||||
private boolean m_shutdowning = false;
|
private boolean m_shutdowning = false;
|
||||||
|
|
||||||
@@ -102,6 +103,10 @@ public class Server {
|
|||||||
System.out.println(BANNER);
|
System.out.println(BANNER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Server() {
|
||||||
|
startTime = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
public static void start(String[] args) throws IOException {
|
public static void start(String[] args) throws IOException {
|
||||||
instance = new Server();
|
instance = new Server();
|
||||||
final IConfig config = defaultConfig();
|
final IConfig config = defaultConfig();
|
||||||
@@ -513,4 +518,7 @@ public class Server {
|
|||||||
public ThreadPoolExecutorWrapper getCallbackScheduler() {
|
public ThreadPoolExecutorWrapper getCallbackScheduler() {
|
||||||
return callbackScheduler;
|
return callbackScheduler;
|
||||||
}
|
}
|
||||||
|
public long getRunTime() {
|
||||||
|
return (System.currentTimeMillis() - startTime)/1000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
package win.liyufan.im;
|
package win.liyufan.im;
|
||||||
|
|
||||||
|
import io.moquette.server.Server;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
@@ -34,10 +36,8 @@ public class GitRepositoryState {
|
|||||||
public final String buildTime;
|
public final String buildTime;
|
||||||
public final String buildHost;
|
public final String buildHost;
|
||||||
public final String buildVersion;
|
public final String buildVersion;
|
||||||
|
|
||||||
public final long runTime;
|
public final long runTime;
|
||||||
|
|
||||||
private final static long startTime = System.currentTimeMillis();
|
|
||||||
|
|
||||||
private GitRepositoryState(Properties properties) {
|
private GitRepositoryState(Properties properties) {
|
||||||
this.tags = String.valueOf(properties.get("git.tags"));
|
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.buildTime = String.valueOf(properties.get("git.build.time"));
|
||||||
this.buildHost = String.valueOf(properties.get("git.build.host"));
|
this.buildHost = String.valueOf(properties.get("git.build.host"));
|
||||||
this.buildVersion = String.valueOf(properties.get("git.build.version"));
|
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 {
|
public static GitRepositoryState getGitRepositoryState() throws IOException {
|
||||||
|
|||||||
Reference in New Issue
Block a user