summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/main/java
diff options
context:
space:
mode:
authorkissand <andras.zoltan.kiss@est.tech>2022-06-15 13:48:07 +0200
committerkissand <andras.zoltan.kiss@est.tech>2022-06-17 11:11:14 +0200
commit3b1d84ac048bd057a5497a2d0243cba675980781 (patch)
treeb79e1f6cfab3da9d7b7ba6f4cc79ee6f70781c59 /cps-ncmp-service/src/main/java
parent44d933db05217eac411eec4972a0d7c880cf5c4e (diff)
Quick fix for performance degradation bug
Issue-ID: CPS-1085 Change-Id: I15715ef37909d4e2fe2f1f80e621a21c8037fbd0 Signed-off-by: kissand <andras.zoltan.kiss@est.tech>
Diffstat (limited to 'cps-ncmp-service/src/main/java')
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java
index 00cbe69f54..3deaa7d237 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyCmHandlerQueryServiceImpl.java
@@ -31,6 +31,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.onap.cps.ncmp.api.NetworkCmProxyCmHandlerQueryService;
@@ -126,17 +127,19 @@ public class NetworkCmProxyCmHandlerQueryServiceImpl implements NetworkCmProxyCm
final Map<DataNodeIdentifier, DataNode> amalgamatedQueryResults) {
boolean firstQuery = true;
if (!getModuleNames(cmHandleQueryServiceParameters.getCmHandleQueryParameters()).isEmpty()) {
- final Collection<Anchor> anchors = cpsAdminPersistenceService.queryAnchors("NFP-Operational",
- getModuleNames(cmHandleQueryServiceParameters.getCmHandleQueryParameters()));
- anchors.forEach(anchor -> {
- final List<DataNode> dataNodes = getDataNodes("//cm-handles[@id='" + anchor.getName() + "']");
- dataNodes.parallelStream().forEach(dataNode -> {
+ final Collection<String> anchorNames = cpsAdminPersistenceService.queryAnchors("NFP-Operational",
+ getModuleNames(cmHandleQueryServiceParameters.getCmHandleQueryParameters()))
+ .parallelStream().map(Anchor::getName).collect(Collectors.toList());
+
+ getAllCmHandles().forEach(dataNode -> {
+ if (anchorNames.contains(dataNode.getLeaves().get("id").toString())) {
final DataNodeIdentifier dataNodeIdentifier =
jsonObjectMapper.convertToValueType(dataNode, DataNodeIdentifier.class);
amalgamatedQueryResultIdentifiers.add(dataNodeIdentifier);
amalgamatedQueryResults.put(dataNodeIdentifier, dataNode);
- });
+ }
});
+
firstQuery = false;
}
return firstQuery;