use of com.sun.enterprise.universal.Duration in project Payara by payara.
the class DomainRootImpl method getUptimeMillis.
public Object[] getUptimeMillis() {
final ServerEnvironmentImpl env = InjectedValues.getInstance().getServerEnvironment();
final long elapsed = System.currentTimeMillis() - env.getStartupContext().getCreationTime();
final Duration duration = new Duration(elapsed);
return new Object[] { elapsed, duration.toString() };
}
use of com.sun.enterprise.universal.Duration in project Payara by payara.
the class UptimeCommand method execute.
public void execute(AdminCommandContext context) {
final ActionReport report = context.getActionReport();
long totalTime_ms = getUptime();
String totalTime_mss = "" + totalTime_ms;
Duration duration = new Duration(totalTime_ms);
duration.setTerse();
report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
String message;
if (milliseconds)
message = totalTime_mss;
else
message = localStrings.getLocalString("uptime.output.terse", "Uptime: {0}", duration);
report.setMessage(message);
report.getTopMessagePart().addProperty("milliseconds", totalTime_mss);
}
Aggregations