aboutsummaryrefslogtreecommitdiffstats
path: root/participant
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-08-25 22:12:26 +0000
committerGerrit Code Review <gerrit@onap.org>2021-08-25 22:12:26 +0000
commitdb82b84e140e78e5f4145ed6d73fe089134dd173 (patch)
tree768c725bdf82d8e5dcf4b6b175a54de63b62898b /participant
parente9fc4bb89eb992bc3ff51fffcda2e6187bcc8ab7 (diff)
parent4bd0c9befe3256958d6f0a862dde4973dcedda9b (diff)
Merge "Intermittent issue in event handling between Cl runtime and participants"
Diffstat (limited to 'participant')
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
index daf9ebe39..2bc21f713 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java
@@ -27,6 +27,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
+import java.util.stream.Collectors;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
@@ -250,13 +251,13 @@ public class ControlLoopHandler {
}
private List<ControlLoopElement> storeElementsOnThisParticipant(List<ParticipantUpdates> participantUpdates) {
- List<ControlLoopElement> clElementMap = new ArrayList<>();
- for (ParticipantUpdates participantUpdate : participantUpdates) {
- if (participantUpdate.getParticipantId().equals(participantType)) {
- clElementMap = participantUpdate.getControlLoopElementList();
- }
- }
- for (ControlLoopElement element : clElementMap) {
+ var clElementMap =
+ participantUpdates.stream()
+ .flatMap(participantUpdate -> participantUpdate.getControlLoopElementList().stream())
+ .filter(element -> participantType.equals(element.getParticipantType()))
+ .collect(Collectors.toList());
+
+ for (var element : clElementMap) {
elementsOnThisParticipant.put(element.getId(), element);
}
return clElementMap;