Refactor: Extract two methods from submitIntentData()

Change-Id: I2c75039bed836ec3695bee1c8a7664bea8779d9e
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 ebf8112..082f4a3 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
@@ -294,18 +294,24 @@
     }
 
     private CompletableFuture<FinalIntentProcessPhase> submitIntentData(IntentData data) {
-        IntentData current = store.getIntentData(data.key());
-        IntentProcessPhase initial = newInitialPhase(processor, data, current);
-        return CompletableFuture.supplyAsync(() -> {
-            Optional<IntentProcessPhase> currentPhase = Optional.of(initial);
-            IntentProcessPhase previousPhase = initial;
+        IntentProcessPhase initial = createInitialPhase(data);
+        return CompletableFuture.supplyAsync(() -> process(initial), workerExecutor);
+    }
 
-            while (currentPhase.isPresent()) {
-                previousPhase = currentPhase.get();
-                currentPhase = previousPhase.execute();
-            }
-            return (FinalIntentProcessPhase) previousPhase;
-        }, workerExecutor);
+    private IntentProcessPhase createInitialPhase(IntentData data) {
+        IntentData current = store.getIntentData(data.key());
+        return newInitialPhase(processor, data, current);
+    }
+
+    private FinalIntentProcessPhase process(IntentProcessPhase initial) {
+        Optional<IntentProcessPhase> currentPhase = Optional.of(initial);
+        IntentProcessPhase previousPhase = initial;
+
+        while (currentPhase.isPresent()) {
+            previousPhase = currentPhase.get();
+            currentPhase = previousPhase.execute();
+        }
+        return (FinalIntentProcessPhase) previousPhase;
     }
 
     private class InternalBatchDelegate implements IntentBatchDelegate {