diff --git a/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/service/RecommendationServiceImpl.java b/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/service/RecommendationServiceImpl.java index 50c1b909362..39769f700a7 100644 --- a/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/service/RecommendationServiceImpl.java +++ b/inception/inception-recommendation/src/main/java/de/tudarmstadt/ukp/inception/recommendation/service/RecommendationServiceImpl.java @@ -1045,8 +1045,9 @@ public void setSuspended(String aSessionOwner, Project aProject, boolean aState) } } - @EventListener + // Set order so this is handled before session info is removed from sessionRegistry @Order(Ordered.HIGHEST_PRECEDENCE) + @EventListener public void onSessionDestroyed(SessionDestroyedEvent event) { var info = sessionRegistry.getSessionInformation(event.getId()); diff --git a/inception/inception-scheduling/src/main/java/de/tudarmstadt/ukp/inception/scheduling/SchedulingServiceImpl.java b/inception/inception-scheduling/src/main/java/de/tudarmstadt/ukp/inception/scheduling/SchedulingServiceImpl.java index a0cec1b937f..31274fa9ff0 100644 --- a/inception/inception-scheduling/src/main/java/de/tudarmstadt/ukp/inception/scheduling/SchedulingServiceImpl.java +++ b/inception/inception-scheduling/src/main/java/de/tudarmstadt/ukp/inception/scheduling/SchedulingServiceImpl.java @@ -442,8 +442,9 @@ public void afterProjectRemoved(AfterProjectRemovedEvent aEvent) throws IOExcept deletionPending.remove(aEvent.getProject()); } - @EventListener + // Set order so this is handled before session info is removed from sessionRegistry @Order(Ordered.HIGHEST_PRECEDENCE) + @EventListener public void onSessionDestroyed(SessionDestroyedEvent event) { LOG.debug("Cleaning up tasks on session destroyed"); diff --git a/inception/inception-ui-curation/src/main/java/de/tudarmstadt/ukp/inception/ui/curation/sidebar/CurationSidebarServiceImpl.java b/inception/inception-ui-curation/src/main/java/de/tudarmstadt/ukp/inception/ui/curation/sidebar/CurationSidebarServiceImpl.java index 4f27b6cd141..acc9b640fd8 100644 --- a/inception/inception-ui-curation/src/main/java/de/tudarmstadt/ukp/inception/ui/curation/sidebar/CurationSidebarServiceImpl.java +++ b/inception/inception-ui-curation/src/main/java/de/tudarmstadt/ukp/inception/ui/curation/sidebar/CurationSidebarServiceImpl.java @@ -52,6 +52,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.event.EventListener; +import org.springframework.core.Ordered; +import org.springframework.core.annotation.Order; import org.springframework.security.core.session.SessionDestroyedEvent; import org.springframework.security.core.session.SessionRegistry; import org.springframework.transaction.annotation.Transactional; @@ -374,6 +376,8 @@ public void setDefaultSelectedUsersForDocument(String aSessionOwner, SourceDocum listCuratableUsers(aSessionOwner, aDocument)); } + // Set order so this is handled before session info is removed from sessionRegistry + @Order(Ordered.HIGHEST_PRECEDENCE) @EventListener @Transactional public void onSessionDestroyed(SessionDestroyedEvent event) @@ -448,9 +452,9 @@ private void storeCurationSettings(User aSessionOwner) private void closeAllSessions(User aSessionOwner) { - projectService.listAccessibleProjects(aSessionOwner).stream() // - .map(Project::getId) // - .forEach(pId -> closeSession(aSessionOwner.getUsername(), pId)); + synchronized (sessions) { + sessions.keySet().removeIf(k -> k.username.equals(aSessionOwner.getUsername())); + } } @Transactional