Jonathan Hart
Committed by Gerrit Code Review

Fix for app dependency loading order issue

Change-Id: Ic4210644bb4a7c433c6e4bd6a33136d2bdfe1e5a
...@@ -335,18 +335,17 @@ public class DistributedApplicationStore extends ApplicationArchive ...@@ -335,18 +335,17 @@ public class DistributedApplicationStore extends ApplicationArchive
335 335
336 336
337 private void activate(ApplicationId appId, boolean updateTime) { 337 private void activate(ApplicationId appId, boolean updateTime) {
338 - AtomicBoolean stateChanged = new AtomicBoolean(false); 338 + Versioned<InternalApplicationHolder> vAppHolder = apps.get(appId);
339 - InternalApplicationHolder appHolder = Versioned.valueOrNull(apps.computeIf(appId, 339 + if (vAppHolder != null) {
340 - v -> v != null && v.state() != ACTIVATED,
341 - (k, v) -> {
342 - stateChanged.set(true);
343 - return new InternalApplicationHolder(v.app(), ACTIVATED, v.permissions());
344 - }));
345 - if (stateChanged.get()) {
346 if (updateTime) { 340 if (updateTime) {
347 updateTime(appId.name()); 341 updateTime(appId.name());
348 } 342 }
349 - activateRequiredApps(appHolder.app()); 343 + activateRequiredApps(vAppHolder.value().app());
344 +
345 + apps.computeIf(appId, v -> v != null && v.state() != ACTIVATED,
346 + (k, v) -> new InternalApplicationHolder(
347 + v.app(), ACTIVATED, v.permissions()));
348 +
350 } 349 }
351 } 350 }
352 351
......