diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2021-08-20 15:05:26 +0100 |
---|---|---|
committer | FrancescoFioraEst <francesco.fiora@est.tech> | 2021-08-24 14:42:12 +0100 |
commit | 4bd0c9befe3256958d6f0a862dde4973dcedda9b (patch) | |
tree | b060bcb62b9f7c49bf968b894d68c7865887bc68 /participant/participant-intermediary/src | |
parent | bf06e83f40cdbfcfc1428040bf8fa58a518cdea4 (diff) |
Intermittent issue in event handling between Cl runtime and participants
Issue-ID: POLICY-3544
Change-Id: I40c5dc537b17986d01ab0d213e7ea7c9cdb7d59e
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-intermediary/src')
-rw-r--r-- | participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ControlLoopHandler.java | 15 |
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; |