Fix ConcurrentModificationException when processing PendingRemoveNextObjectives
Change-Id: Iaffad21812c86e26f0c9d44e39bc7e301c841bfe
(cherry picked from commit a761173fcba8f03b08c823af989adf987abee7c2)
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/OfdpaGroupHandlerUtility.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/OfdpaGroupHandlerUtility.java
index 5e48ebf..b962153 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/OfdpaGroupHandlerUtility.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/OfdpaGroupHandlerUtility.java
@@ -705,13 +705,9 @@
keys.forEach(key -> groupHandler.processPendingUpdateNextObjs(key));
Set<GroupKey> k = Sets.newHashSet();
- groupHandler.pendingRemoveNextObjectives
- .asMap().values().stream().forEach(keylist -> {
- k.addAll(keylist.stream()
- .filter(key -> groupHandler.groupService
- .getGroup(groupHandler.deviceId, key) == null)
- .collect(Collectors.toSet()));
- });
+ groupHandler.pendingRemoveNextObjectives.asMap().values().forEach(keylist -> keylist.stream()
+ .filter(key -> groupHandler.groupService.getGroup(groupHandler.deviceId, key) == null)
+ .forEach(k::add));
k.forEach(key -> groupHandler.processPendingRemoveNextObjs(key));
} catch (Exception exception) {