From 2b2028e22fabcf669008db1acfbfa33826809f10 Mon Sep 17 00:00:00 2001 From: Olli Tietäväinen Date: Tue, 5 Oct 2021 09:36:52 +0300 Subject: Improve thread safety (#12395) (#12417) See: https://vaadin.com/forum/thread/17522264/concurrentmodificationexception-in-vaadin-shared-on-karaf-4-2-x Co-authored-by: Tatu Lund --- .../osgi/resources/impl/VaadinResourceTrackerComponent.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'shared') diff --git a/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceTrackerComponent.java b/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceTrackerComponent.java index 330e5f44e8..49d66321ea 100644 --- a/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceTrackerComponent.java +++ b/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceTrackerComponent.java @@ -151,9 +151,11 @@ public class VaadinResourceTrackerComponent { */ @Activate protected void activate(BundleContext context) { - vaadinSharedContext = context; - for (Delegate registration : resourceToRegistration.values()) { - registration.register(vaadinSharedContext, vaadinService); + synchronized (resourceToRegistration) { + vaadinSharedContext = context; + for (Delegate registration : resourceToRegistration.values()) { + registration.register(context, vaadinService); + } } } -- cgit v1.2.3