From d33b07736abf98e80fe1d36c77ef2f1158d51689 Mon Sep 17 00:00:00 2001 From: Madan Jampani Date: Fri, 14 Aug 2015 10:30:55 -0700 Subject: [PATCH] ONOS-2626: Make a immutable copy of multimap before iterating over it Change-Id: I04cddc4fb9a007920783e44b62143d5d2c0553ba --- .../java/org/onosproject/store/host/impl/ECHostStore.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/store/dist/src/main/java/org/onosproject/store/host/impl/ECHostStore.java b/core/store/dist/src/main/java/org/onosproject/store/host/impl/ECHostStore.java index 17bdbbe498..d6980116d0 100644 --- a/core/store/dist/src/main/java/org/onosproject/store/host/impl/ECHostStore.java +++ b/core/store/dist/src/main/java/org/onosproject/store/host/impl/ECHostStore.java @@ -50,6 +50,7 @@ import org.onosproject.store.service.StorageService; import org.slf4j.Logger; import com.google.common.collect.HashMultimap; +import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Multimaps; import com.google.common.collect.SetMultimap; @@ -174,7 +175,8 @@ public class ECHostStore @Override public Set getConnectedHosts(DeviceId deviceId) { - return locations.entries() + return ImmutableMultimap.copyOf(locations) + .entries() .stream() .filter(entry -> entry.getKey().deviceId().equals(deviceId)) .map(entry -> entry.getValue())