Madan Jampani
Committed by Brian O'Connor

Avoid concurrent modification exception by iterating over a immutable collection

Change-Id: Icfffa1347071eb298a25b11ee0511f36002b0675
(cherry picked from commit e81f1cf2)
...@@ -47,7 +47,6 @@ import org.apache.felix.scr.annotations.Reference; ...@@ -47,7 +47,6 @@ import org.apache.felix.scr.annotations.Reference;
47 import org.apache.felix.scr.annotations.ReferenceCardinality; 47 import org.apache.felix.scr.annotations.ReferenceCardinality;
48 import org.apache.felix.scr.annotations.ReferencePolicy; 48 import org.apache.felix.scr.annotations.ReferencePolicy;
49 import org.apache.felix.scr.annotations.Service; 49 import org.apache.felix.scr.annotations.Service;
50 -
51 import org.onosproject.app.ApplicationEvent; 50 import org.onosproject.app.ApplicationEvent;
52 import org.onosproject.app.ApplicationListener; 51 import org.onosproject.app.ApplicationListener;
53 import org.onosproject.app.ApplicationService; 52 import org.onosproject.app.ApplicationService;
...@@ -252,7 +251,7 @@ public class DatabaseManager implements StorageService, StorageAdminService { ...@@ -252,7 +251,7 @@ public class DatabaseManager implements StorageService, StorageAdminService {
252 log.info("Successfully closed databases."); 251 log.info("Successfully closed databases.");
253 } 252 }
254 }); 253 });
255 - maps.values().forEach(this::unregisterMap); 254 + ImmutableList.copyOf(maps.values()).forEach(this::unregisterMap);
256 if (applicationService != null) { 255 if (applicationService != null) {
257 applicationService.removeListener(appListener); 256 applicationService.removeListener(appListener);
258 } 257 }
......