Refactor: Decompose creating CompletableFuture and process intent
Change-Id: I09de2965b7fbf593c1baf3b2e95ab15437f9a092
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
index 6802aba..a530797 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
@@ -325,8 +325,9 @@
(we can also try to update these individually)
*/
List<CompletableFuture<IntentData>> futures = operations.stream()
- .map(x -> createInitialPhase(x))
- .map(x -> CompletableFuture.supplyAsync(() -> process(x), workerExecutor))
+ .map(IntentManager.this::createInitialPhase)
+ .map(CompletableFuture::completedFuture)
+ .map(x -> x.thenApplyAsync(IntentManager.this::process, workerExecutor))
.map(x -> x.thenApply(FinalIntentProcessPhase::data))
.map(x -> x.exceptionally(e -> {
//FIXME