aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/services/AAITreeNodeBuilder.java
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-11-06 14:27:53 +0200
committerIttay Stern <ittay.stern@att.com>2019-11-07 14:19:47 +0000
commit97d42f7035ade2c171c349d01cfcd9b61b71dd52 (patch)
tree1a1b6d7c52545fcf78a0eb94eb12ec6d225c5d58 /vid-app-common/src/main/java/org/onap/vid/services/AAITreeNodeBuilder.java
parentebef5249cb9d282ace976feac8517a7b44add450 (diff)
fix - when retrieve topology we are using threadPool and the MDC values are not updated
This time for homing-by-vnf-id parallel requests. Issue-ID: VID-253 Change-Id: Ic0be1470445c6fef0e18f9b9d8f1604df508265b Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/services/AAITreeNodeBuilder.java')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/AAITreeNodeBuilder.java15
1 files changed, 6 insertions, 9 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AAITreeNodeBuilder.java b/vid-app-common/src/main/java/org/onap/vid/services/AAITreeNodeBuilder.java
index c8434609e..209f37025 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/AAITreeNodeBuilder.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/AAITreeNodeBuilder.java
@@ -59,6 +59,7 @@ import org.onap.vid.model.aaiTree.FailureAAITreeNode;
import org.onap.vid.model.aaiTree.NodeType;
import org.onap.vid.mso.model.CloudConfiguration;
import org.onap.vid.properties.VidProperties;
+import org.onap.vid.utils.Logging;
import org.onap.vid.utils.Streams;
import org.onap.vid.utils.Tree;
import org.onap.vid.utils.Unchecked;
@@ -71,7 +72,8 @@ import org.springframework.stereotype.Component;
public class AAITreeNodeBuilder {
private static final String RESULTS = "results";
- private AaiClientInterface aaiClient;
+ private final AaiClientInterface aaiClient;
+ private final Logging logging;
private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(AAITreeNodeBuilder.class);
@@ -97,8 +99,9 @@ public class AAITreeNodeBuilder {
}
@Inject
- public AAITreeNodeBuilder(AaiClientInterface aaiClient) {
+ public AAITreeNodeBuilder(AaiClientInterface aaiClient, Logging logging) {
this.aaiClient = aaiClient;
+ this.logging = logging;
}
List<AAITreeNode> buildNode(NodeType nodeType,
@@ -296,13 +299,7 @@ public class AAITreeNodeBuilder {
}
private <V> Callable<V> withCopyOfMDC(Callable<V> callable) {
- //in order to be able to write the correct data while creating the node on a new thread
- // save a copy of the current thread's context map, with keys and values of type String.
- final Map<String, String> copyOfParentMDC = MDC.getCopyOfContextMap();
- return () -> {
- MDC.setContextMap(copyOfParentMDC);
- return callable.call();
- };
+ return logging.withMDC(MDC.getCopyOfContextMap(), callable);
}
private List<AAITreeNode> getChildNode(ExecutorService threadPool, ConcurrentSkipListSet<AAITreeNode> nodesAccumulator,