commit | 99b7b34663d885850bfb25d521d4adcc88179223 | [log] [tgz] |
---|---|---|
author | HIGUCHI Yuta <y-higuchi@ak.jp.nec.com> | Tue Sep 29 16:54:21 2015 -0700 |
committer | Gerrit Code Review <gerrit@onlab.us> | Wed Sep 30 20:59:11 2015 +0000 |
tree | 7a07774ef6878094e1781d0e9e897cc7f783b3e9 | |
parent | 03c3206f3b7ab24c68673bede3fb4e941c38106f [diff] |
Fix synchronization issue - synchronizedMultiMaps needs to be synchronized, when iterating over it's contents. See: http://static.javadoc.io/com.google.guava/guava/18.0/com/google/common/collect/Multimaps.html#synchronizedMultimap(com.google.common.collect.Multimap) Change-Id: I398079a67e9fab58edc9d6f0295169939e640ba2
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java index 1f3f852..5ebc812 100644 --- a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java +++ b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
@@ -375,7 +375,12 @@ } // TODO should we recompile on available==true? - delegate.triggerCompile(ImmutableSet.copyOf(intentsByDevice.get(id)), available); + + final ImmutableSet<Key> snapshot; + synchronized (intentsByDevice) { + snapshot = ImmutableSet.copyOf(intentsByDevice.get(id)); + } + delegate.triggerCompile(snapshot, available); } }
diff --git a/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DatabaseManager.java b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DatabaseManager.java index fbc2c88..6ea7c22 100644 --- a/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DatabaseManager.java +++ b/core/store/dist/src/main/java/org/onosproject/store/consistent/impl/DatabaseManager.java
@@ -443,7 +443,10 @@ public void event(ApplicationEvent event) { if (event.type() == APP_UNINSTALLED || event.type() == APP_DEACTIVATED) { ApplicationId appId = event.subject().id(); - List<DefaultAsyncConsistentMap> mapsToRemove = ImmutableList.copyOf(mapsByApplication.get(appId)); + List<DefaultAsyncConsistentMap> mapsToRemove; + synchronized (mapsByApplication) { + mapsToRemove = ImmutableList.copyOf(mapsByApplication.get(appId)); + } mapsToRemove.forEach(DatabaseManager.this::unregisterMap); if (event.type() == APP_UNINSTALLED) { mapsToRemove.stream().filter(map -> map.purgeOnUninstall()).forEach(map -> map.clear());