diff options
author | Tatu Lund <tatu@vaadin.com> | 2021-09-08 14:58:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-08 14:58:15 +0300 |
commit | 240dc9ef3875f5d0f87ca9285dedcf1c07f74d72 (patch) | |
tree | 3532e7de9d953edcafd3bd480b6aaac888ff3d6b | |
parent | 7f632bfaba1e7934815fe64ec87c975582b495f3 (diff) | |
download | vaadin-framework-240dc9ef3875f5d0f87ca9285dedcf1c07f74d72.tar.gz vaadin-framework-240dc9ef3875f5d0f87ca9285dedcf1c07f74d72.zip |
Improve thread safety (#12395)
See: https://vaadin.com/forum/thread/17522264/concurrentmodificationexception-in-vaadin-shared-on-karaf-4-2-x
-rw-r--r-- | shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceTrackerComponent.java | 8 |
1 files changed, 5 insertions, 3 deletions
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); + } } } |