diff --git a/src/main/org/epics/archiverappliance/config/ConfigService.java b/src/main/org/epics/archiverappliance/config/ConfigService.java index ff7ec7cd3..11857642e 100644 --- a/src/main/org/epics/archiverappliance/config/ConfigService.java +++ b/src/main/org/epics/archiverappliance/config/ConfigService.java @@ -151,6 +151,12 @@ public enum WAR_FILE { MGMT, RETRIEVAL, ETL, ENGINE } */ public boolean isStartupComplete(); + /** + * Get an approximate time in epoch seconds when the appserver started up. + * @return + */ + public long getTimeOfAppserverStartup(); + /** * The name/path of the archappl.properties file. * By default, we look for archappl.properties in the webapp's classpath - this will typically resolve into WEB-INF/classes of the webapp. diff --git a/src/main/org/epics/archiverappliance/config/DefaultConfigService.java b/src/main/org/epics/archiverappliance/config/DefaultConfigService.java index 0f07dd293..0af526943 100644 --- a/src/main/org/epics/archiverappliance/config/DefaultConfigService.java +++ b/src/main/org/epics/archiverappliance/config/DefaultConfigService.java @@ -189,6 +189,8 @@ public ExecutePolicy load(String key) throws IOException { private ServletContext servletContext; + + private long appserverStartEpochSeconds = TimeUtils.getCurrentEpochSeconds(); protected DefaultConfigService() { // Only the unit tests config service uses this constructor. @@ -1994,4 +1996,10 @@ public void setNamedFlag(String name, boolean value) { public Set getNamedFlagNames() { return namedFlags.keySet(); } + + @Override + public long getTimeOfAppserverStartup() { + return this.appserverStartEpochSeconds; + } + } diff --git a/src/main/org/epics/archiverappliance/engine/bpl/reports/CurrentlyDisconnectedPVsAction.java b/src/main/org/epics/archiverappliance/engine/bpl/reports/CurrentlyDisconnectedPVsAction.java index 3e9f727a4..d20c451be 100644 --- a/src/main/org/epics/archiverappliance/engine/bpl/reports/CurrentlyDisconnectedPVsAction.java +++ b/src/main/org/epics/archiverappliance/engine/bpl/reports/CurrentlyDisconnectedPVsAction.java @@ -42,7 +42,8 @@ public void execute(HttpServletRequest req, HttpServletResponse resp, ConfigServ pvStatus.put("instance", identity); pvStatus.put("lastKnownEvent", TimeUtils.convertToHumanReadableString(pvMetrics.getSecondsOfLastEvent())); long connectionLastLostEpochSeconds = pvMetrics.getConnectionLastLostEpochSeconds(); - pvStatus.put("connectionLostAt", connectionLastLostEpochSeconds > 0 ? TimeUtils.convertToHumanReadableString(connectionLastLostEpochSeconds) : "N/A"); + pvStatus.put("connectionLostAt", connectionLastLostEpochSeconds > 0 ? TimeUtils.convertToHumanReadableString(connectionLastLostEpochSeconds) : TimeUtils.convertToHumanReadableString(configService.getTimeOfAppserverStartup())); + pvStatus.put("noConnectionAsOfEpochSecs", Long.toString(connectionLastLostEpochSeconds > 0 ? connectionLastLostEpochSeconds : configService.getTimeOfAppserverStartup())); String hostName = channel.getHostName(); pvStatus.put("hostName", hostName != null ? hostName : "N/A"); pvStatus.put("commandThreadID", Integer.toString(channel.getJCACommandThreadID()));