Move method to IntentProcessPhase
Change-Id: Id9e898d983f3b041dbb376070ef31e36318b40c3
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 a0d1d9b..fcdb033 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
@@ -298,7 +298,7 @@
List<CompletableFuture<IntentData>> futures = operations.stream()
.map(x -> CompletableFuture.completedFuture(x)
.thenApply(IntentManager.this::createInitialPhase)
- .thenApplyAsync(IntentManager.this::process, workerExecutor)
+ .thenApplyAsync(IntentProcessPhase::process, workerExecutor)
.thenApply(FinalIntentProcessPhase::data)
.exceptionally(e -> {
//FIXME
@@ -329,17 +329,6 @@
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 InternalIntentProcessor implements IntentProcessor {
@Override
public List<Intent> compile(Intent intent, List<Intent> previousInstallables) {
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/phase/IntentProcessPhase.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/IntentProcessPhase.java
index bef28ac..d2f9f36 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/phase/IntentProcessPhase.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/IntentProcessPhase.java
@@ -58,6 +58,17 @@
}
}
+ static 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;
+ }
+
static void transferErrorCount(IntentData data, Optional<IntentData> stored) {
stored.ifPresent(storedData -> {
if (Objects.equals(data.intent(), storedData.intent()) &&