Browse Source

Merge pull request #11667 from YevhenBondarenko/fix/topic-service-concurrent-modification

fixed concurrent modification in TopicService
pull/11762/head
Viacheslav Klimov 2 years ago
committed by GitHub
parent
commit
94acea1e7e
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java

8
common/queue/src/main/java/org/thingsboard/server/queue/discovery/TopicService.java

@ -21,8 +21,8 @@ import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.msg.queue.ServiceType; import org.thingsboard.server.common.msg.queue.ServiceType;
import org.thingsboard.server.common.msg.queue.TopicPartitionInfo; import org.thingsboard.server.common.msg.queue.TopicPartitionInfo;
import java.util.HashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.Map; import java.util.concurrent.ConcurrentMap;
@Service @Service
public class TopicService { public class TopicService {
@ -30,8 +30,8 @@ public class TopicService {
@Value("${queue.prefix:}") @Value("${queue.prefix:}")
private String prefix; private String prefix;
private Map<String, TopicPartitionInfo> tbCoreNotificationTopics = new HashMap<>(); private final ConcurrentMap<String, TopicPartitionInfo> tbCoreNotificationTopics = new ConcurrentHashMap<>();
private Map<String, TopicPartitionInfo> tbRuleEngineNotificationTopics = new HashMap<>(); private final ConcurrentMap<String, TopicPartitionInfo> tbRuleEngineNotificationTopics = new ConcurrentHashMap<>();
/** /**
* Each Service should start a consumer for messages that target individual service instance based on serviceId. * Each Service should start a consumer for messages that target individual service instance based on serviceId.

Loading…
Cancel
Save