diff --git a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionDetails.java b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionDetails.java index 8334e9a9..885dcc72 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionDetails.java +++ b/src/main/java/ch/ethz/seb/sebserver/gui/service/session/ClientConnectionDetails.java @@ -137,7 +137,8 @@ public class ClientConnectionDetails { final ClientConnectionData connectionData = this.restCallBuilder .call() .get(error -> { - log.error("Unexpected error while trying to get current client connection data: ", error); + log.error("Unexpected error while trying to get current client connection data: {}", + error.getMessage()); recoverFromDisposedRestTemplate(error); return null; }); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ClientIndicatorFactory.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ClientIndicatorFactory.java index 5be1a549..39102fc7 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ClientIndicatorFactory.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ClientIndicatorFactory.java @@ -54,8 +54,14 @@ public class ClientIndicatorFactory { } public List createFor(final ClientConnection clientConnection) { - final List result = new ArrayList<>(); + return createFor(clientConnection, false); + } + public List createFor( + final ClientConnection clientConnection, + final boolean enableCachingOverride) { + + final List result = new ArrayList<>(); if (clientConnection.examId == null) { return result; } @@ -82,7 +88,7 @@ public class ClientIndicatorFactory { indicatorDef, clientConnection.id, clientConnection.status.clientActiveStatus, - this.enableCaching); + this.enableCaching || enableCachingOverride); result.add(indicator); } catch (final Exception e) { @@ -111,7 +117,7 @@ public class ClientIndicatorFactory { indicator, clientConnection.id, clientConnection.status.clientActiveStatus, - this.enableCaching); + this.enableCaching || enableCachingOverride); result.add(pingIndicator); } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionCacheService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionCacheService.java index 112a6e92..9d8cf3c0 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionCacheService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/ExamSessionCacheService.java @@ -148,7 +148,9 @@ public class ExamSessionCacheService { if (clientConnection == null) { return null; } else { - return this.internalClientConnectionDataFactory.createClientConnectionData(clientConnection); + return this.internalClientConnectionDataFactory.createClientConnectionData( + clientConnection, + this.getRunningExam(clientConnection.examId) != null); } } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/InternalClientConnectionDataFactory.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/InternalClientConnectionDataFactory.java index 54b23f19..f576f982 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/InternalClientConnectionDataFactory.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/InternalClientConnectionDataFactory.java @@ -32,7 +32,16 @@ public class InternalClientConnectionDataFactory { this.sebClientNotificationService = sebClientNotificationService; } - public ClientConnectionDataInternal createClientConnectionData(final ClientConnection clientConnection) { + public ClientConnectionDataInternal createClientConnectionData( + final ClientConnection clientConnection, + final boolean examRunning) { + + if (!examRunning) { + return new ClientConnectionDataInternal( + clientConnection, + () -> false, + this.clientIndicatorFactory.createFor(clientConnection, true)); + } if (clientConnection.status == ConnectionStatus.CLOSED || clientConnection.status == ConnectionStatus.DISABLED) { diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/DistributedIndicatorValueService.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/DistributedIndicatorValueService.java index a7379e01..1850f4c3 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/DistributedIndicatorValueService.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/DistributedIndicatorValueService.java @@ -287,10 +287,6 @@ public class DistributedIndicatorValueService implements DisposableBean { if (value == null) { try { - if (log.isDebugEnabled()) { - log.debug("*** Get and cache ping time: {}", indicatorPK); - } - value = this.clientIndicatorValueMapper.selectValueByPrimaryKey(indicatorPK); if (value != null) { this.indicatorValueCache.put(indicatorPK, value); diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/PingIntervalClientIndicator.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/PingIntervalClientIndicator.java index ba933dd9..cc3b63bf 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/PingIntervalClientIndicator.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/PingIntervalClientIndicator.java @@ -87,6 +87,7 @@ public final class PingIntervalClientIndicator extends AbstractPingIndicator { final long currentTimeMillis = DateTimeUtils.currentTimeMillis(); this.currentValue = computeValueAt(currentTimeMillis); + this.lastUpdate = this.distributedPingCache.lastUpdate(); return (currentTimeMillis < this.currentValue) ? DateTimeUtils.currentTimeMillis() - this.currentValue : currentTimeMillis - this.currentValue;