diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/AbstractPingIndicator.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/AbstractPingIndicator.java index 553d972d..a67a7546 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/AbstractPingIndicator.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/AbstractPingIndicator.java @@ -77,7 +77,9 @@ public abstract class AbstractPingIndicator extends AbstractClientIndicator { // Update last ping time on persistent storage final long millisecondsNow = DateTimeUtils.currentTimeMillis(); if (millisecondsNow - this.lastUpdate > INTERVAL_FOR_PERSISTENT_UPDATE) { - this.distributedPingCache.updatePing(this.pingRecord, millisecondsNow); + synchronized (this) { + this.distributedPingCache.updatePing(this.pingRecord, millisecondsNow); + } } } } diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/DistributedPingCache.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/DistributedPingCache.java index 5d170162..979df7fa 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/DistributedPingCache.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/session/impl/indicator/DistributedPingCache.java @@ -24,6 +24,7 @@ import org.springframework.beans.factory.DisposableBean; import org.springframework.context.annotation.Lazy; import org.springframework.scheduling.TaskScheduler; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Transactional; import ch.ethz.seb.sebserver.gbl.model.session.ClientEvent.EventType; @@ -180,7 +181,7 @@ public class DistributedPingCache implements DisposableBean { } } - @Transactional(readOnly = true) + @Transactional(readOnly = true, isolation = Isolation.READ_UNCOMMITTED) public void updateCache() { if (this.pingCache.isEmpty()) {