Committed by
Gerrit Code Review
Fixed an NPE due to a race condition while processing pending network configurat…
…ions on multiple nodes concurrently. Change-Id: I4a37adc8d059f63115517dbe628233d1fd295d02
Showing
1 changed file
with
6 additions
and
2 deletions
... | @@ -132,8 +132,12 @@ public class DistributedNetworkConfigStore | ... | @@ -132,8 +132,12 @@ public class DistributedNetworkConfigStore |
132 | ImmutableSet.copyOf(configs.keySet()).forEach(k -> { | 132 | ImmutableSet.copyOf(configs.keySet()).forEach(k -> { |
133 | if (Objects.equals(k.configKey, configFactory.configKey()) && | 133 | if (Objects.equals(k.configKey, configFactory.configKey()) && |
134 | isAssignableFrom(configFactory, k)) { | 134 | isAssignableFrom(configFactory, k)) { |
135 | - validateConfig(k, configFactory, configs.get(k).value()); | 135 | + // Prune whether valid or not |
136 | - configs.remove(k); // Prune whether valid or not | 136 | + Versioned<JsonNode> versioned = configs.remove(k); |
137 | + // Allow for the value to be processed by another node already | ||
138 | + if (versioned != null) { | ||
139 | + validateConfig(k, configFactory, versioned.value()); | ||
140 | + } | ||
137 | } | 141 | } |
138 | }); | 142 | }); |
139 | } | 143 | } | ... | ... |
-
Please register or login to post a comment