Fix for app dependency loading order issue
Change-Id: Ic4210644bb4a7c433c6e4bd6a33136d2bdfe1e5a
(cherry picked from commit e09b71ab0e8cf7f648f345cfa257f24e62804bf9)
diff --git a/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java b/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java
index 027e1a0..3c5447a 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java
@@ -335,18 +335,17 @@
private void activate(ApplicationId appId, boolean updateTime) {
- AtomicBoolean stateChanged = new AtomicBoolean(false);
- InternalApplicationHolder appHolder = Versioned.valueOrNull(apps.computeIf(appId,
- v -> v != null && v.state() != ACTIVATED,
- (k, v) -> {
- stateChanged.set(true);
- return new InternalApplicationHolder(v.app(), ACTIVATED, v.permissions());
- }));
- if (stateChanged.get()) {
+ Versioned<InternalApplicationHolder> vAppHolder = apps.get(appId);
+ if (vAppHolder != null) {
if (updateTime) {
updateTime(appId.name());
}
- activateRequiredApps(appHolder.app());
+ activateRequiredApps(vAppHolder.value().app());
+
+ apps.computeIf(appId, v -> v != null && v.state() != ACTIVATED,
+ (k, v) -> new InternalApplicationHolder(
+ v.app(), ACTIVATED, v.permissions()));
+
}
}