Avoid multi-thread issue of encoding the installable Intents to json
ArrayNode uses ArrayList to store data, which is not thread-safe
Change-Id: Id3e54afdf036cbab0909b08b094a2c52124b6bb9
diff --git a/core/common/src/main/java/org/onosproject/codec/impl/IntentCodec.java b/core/common/src/main/java/org/onosproject/codec/impl/IntentCodec.java
index b21ca4e..ed20958 100644
--- a/core/common/src/main/java/org/onosproject/codec/impl/IntentCodec.java
+++ b/core/common/src/main/java/org/onosproject/codec/impl/IntentCodec.java
@@ -68,15 +68,13 @@
final ArrayNode jsonResources = result.putArray(RESOURCES);
intent.resources()
- .parallelStream()
- .forEach(
- resource -> {
- if (resource instanceof Link) {
- jsonResources.add(context.codec(Link.class).encode((Link) resource, context));
- } else {
- jsonResources.add(resource.toString());
- }
- });
+ .forEach(resource -> {
+ if (resource instanceof Link) {
+ jsonResources.add(context.codec(Link.class).encode((Link) resource, context));
+ } else {
+ jsonResources.add(resource.toString());
+ }
+ });
IntentService service = context.getService(IntentService.class);
IntentState state = service.getIntentState(intent.key());