ARTEMIS-1408 document synchronization

This commit is contained in:
Justin Bertram 2018-01-23 10:58:07 -06:00 committed by Michael Pearce
parent 6ad29e4039
commit 439761d6b8
1 changed files with 2 additions and 0 deletions

View File

@ -80,6 +80,7 @@ public class MQTTSessionState {
}
boolean addSubscription(MqttTopicSubscription subscription, WildcardConfiguration wildcardConfiguration) {
// synchronized to prevent race with removeSubscription
synchronized (subscriptions) {
addressMessageMap.putIfAbsent(MQTTUtil.convertMQTTAddressFilterToCore(subscription.topicName(), wildcardConfiguration), new ConcurrentHashMap<Long, Integer>());
@ -98,6 +99,7 @@ public class MQTTSessionState {
}
void removeSubscription(String address) {
// synchronized to prevent race with addSubscription
synchronized (subscriptions) {
subscriptions.remove(address);
addressMessageMap.remove(address);