summaryrefslogtreecommitdiffstats
path: root/shared
diff options
context:
space:
mode:
authorOlli Tietäväinen <ollit@vaadin.com>2021-10-05 09:36:52 +0300
committerGitHub <noreply@github.com>2021-10-05 09:36:52 +0300
commit2b2028e22fabcf669008db1acfbfa33826809f10 (patch)
tree13493fe9901837e0f598247d53b4ad600bf9c887 /shared
parent2e285e330f8e716295a7505a5d13909f517989b7 (diff)
downloadvaadin-framework-2b2028e22fabcf669008db1acfbfa33826809f10.tar.gz
vaadin-framework-2b2028e22fabcf669008db1acfbfa33826809f10.zip
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 <tatu@vaadin.com>
Diffstat (limited to 'shared')
-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);
+ }
}
}