aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTatu Lund <tatu@vaadin.com>2021-09-08 14:58:15 +0300
committerGitHub <noreply@github.com>2021-09-08 14:58:15 +0300
commit240dc9ef3875f5d0f87ca9285dedcf1c07f74d72 (patch)
tree3532e7de9d953edcafd3bd480b6aaac888ff3d6b
parent7f632bfaba1e7934815fe64ec87c975582b495f3 (diff)
downloadvaadin-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.java8
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);
+ }
}
}