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/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 a197e0ac..376dd618 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;