Jonathan Hart
Committed by Gerrit Code Review

Delay loading startup applications.

We need to ensure ApplicationService is fully activated before we try
to load any applications that may depend on it.

Change-Id: I77bcf2534cc43056facb5dca5b6947ab52e61dcc
......@@ -62,6 +62,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import static com.google.common.collect.Multimaps.newSetMultimap;
......@@ -94,6 +95,8 @@ public class GossipApplicationStore extends ApplicationArchive
private static final int FETCH_TIMEOUT_MS = 10_000;
private static final int APP_LOAD_DELAY_MS = 500;
public enum InternalState {
INSTALLED, ACTIVATED, DEACTIVATED
}
......@@ -230,7 +233,7 @@ public class GossipApplicationStore extends ApplicationArchive
@Override
public void setDelegate(ApplicationStoreDelegate delegate) {
super.setDelegate(delegate);
loadFromDisk();
executor.schedule(() -> loadFromDisk(), APP_LOAD_DELAY_MS, TimeUnit.MILLISECONDS);
}
@Override
......