]> git.basschouten.com Git - openhab-addons.git/commitdiff
[mqtt] fix thread concurrency issue with type provider (#14229)
authorCody Cutrer <cody@cutrer.us>
Sat, 21 Jan 2023 08:59:37 +0000 (01:59 -0700)
committerGitHub <noreply@github.com>
Sat, 21 Jan 2023 08:59:37 +0000 (09:59 +0100)
Signed-off-by: Cody Cutrer <cody@cutrer.us>
bundles/org.openhab.binding.mqtt.generic/src/main/java/org/openhab/binding/mqtt/generic/MqttChannelTypeProvider.java

index eb9296f580f599dd35fd22d082a26f2707d690cf..7267c97186dc9d36bc4a0927ac59cddb7cafc5d2 100644 (file)
@@ -14,10 +14,10 @@ package org.openhab.binding.mqtt.generic;
 
 import java.net.URI;
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.eclipse.jdt.annotation.Nullable;
@@ -53,9 +53,9 @@ import org.osgi.service.component.annotations.Reference;
 public class MqttChannelTypeProvider implements ThingTypeProvider, ChannelGroupTypeProvider, ChannelTypeProvider {
     private final ThingTypeRegistry typeRegistry;
 
-    private final Map<ChannelTypeUID, ChannelType> types = new HashMap<>();
-    private final Map<ChannelGroupTypeUID, ChannelGroupType> groups = new HashMap<>();
-    private final Map<ThingTypeUID, ThingType> things = new HashMap<>();
+    private final Map<ChannelTypeUID, ChannelType> types = new ConcurrentHashMap<>();
+    private final Map<ChannelGroupTypeUID, ChannelGroupType> groups = new ConcurrentHashMap<>();
+    private final Map<ThingTypeUID, ThingType> things = new ConcurrentHashMap<>();
 
     @Activate
     public MqttChannelTypeProvider(@Reference ThingTypeRegistry typeRegistry) {