ARTEMIS-1408 document synchronization
This commit is contained in:
parent
6ad29e4039
commit
439761d6b8
|
@ -80,6 +80,7 @@ public class MQTTSessionState {
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean addSubscription(MqttTopicSubscription subscription, WildcardConfiguration wildcardConfiguration) {
|
boolean addSubscription(MqttTopicSubscription subscription, WildcardConfiguration wildcardConfiguration) {
|
||||||
|
// synchronized to prevent race with removeSubscription
|
||||||
synchronized (subscriptions) {
|
synchronized (subscriptions) {
|
||||||
addressMessageMap.putIfAbsent(MQTTUtil.convertMQTTAddressFilterToCore(subscription.topicName(), wildcardConfiguration), new ConcurrentHashMap<Long, Integer>());
|
addressMessageMap.putIfAbsent(MQTTUtil.convertMQTTAddressFilterToCore(subscription.topicName(), wildcardConfiguration), new ConcurrentHashMap<Long, Integer>());
|
||||||
|
|
||||||
|
@ -98,6 +99,7 @@ public class MQTTSessionState {
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeSubscription(String address) {
|
void removeSubscription(String address) {
|
||||||
|
// synchronized to prevent race with addSubscription
|
||||||
synchronized (subscriptions) {
|
synchronized (subscriptions) {
|
||||||
subscriptions.remove(address);
|
subscriptions.remove(address);
|
||||||
addressMessageMap.remove(address);
|
addressMessageMap.remove(address);
|
||||||
|
|
Loading…
Reference in New Issue