re-added synchronization to look if it has effect

This commit is contained in:
anhefti 2023-06-01 14:29:15 +02:00
parent 2c197665f0
commit 45e01dc0dd
2 changed files with 22 additions and 7 deletions

View file

@ -160,10 +160,16 @@ public class SEBClientEventBatchService {
return eventData;
}
System.out.println("******* storeNotifications: " + eventData);
ClientConnectionDataInternal clientConnection = null;
synchronized (ExamSessionCacheService.CLIENT_CONNECTION_CREATION_LOCK) {
clientConnection = this.examSessionCacheService
.getClientConnection(eventData.connectionToken);
}
final ClientConnectionDataInternal clientConnection = this.examSessionCacheService
.getClientConnection(eventData.connectionToken);
if (clientConnection == null) {
log.error("Failed to get ClientConnectionDataInternal for: {}", eventData.connectionToken);
return null;
}
final Pair<NotificationType, String> typeAndPlainText =
ClientNotification.extractTypeAndPlainText(eventData.event.text);
@ -200,8 +206,12 @@ public class SEBClientEventBatchService {
private ClientEventRecord toEventRecord(final EventData eventData) {
try {
final ClientConnectionDataInternal clientConnection = this.examSessionCacheService
.getClientConnection(eventData.connectionToken);
ClientConnectionDataInternal clientConnection = null;
synchronized (ExamSessionCacheService.CLIENT_CONNECTION_CREATION_LOCK) {
clientConnection = this.examSessionCacheService
.getClientConnection(eventData.connectionToken);
}
if (clientConnection == null) {
log.warn("Failed to retrieve ClientConnection for token {}. Skip this event",

View file

@ -91,11 +91,16 @@ public class SEBClientPingBatchService {
return;
}
final ClientConnectionDataInternal activeClientConnection = this.examSessionCacheService
.getClientConnection(connectionToken);
ClientConnectionDataInternal activeClientConnection = null;
synchronized (ExamSessionCacheService.CLIENT_CONNECTION_CREATION_LOCK) {
activeClientConnection = this.examSessionCacheService
.getClientConnection(connectionToken);
}
if (activeClientConnection != null) {
activeClientConnection.notifyPing(timestamp);
} else {
log.error("Failed to get ClientConnectionDataInternal for: {}", connectionToken);
}
if (instructionConfirm != StringUtils.EMPTY) {