diff options
author | gjoranv <gv@verizonmedia.com> | 2022-09-08 00:13:36 +0200 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2022-09-08 00:13:36 +0200 |
commit | e00663f15d41565c525282930c2983b0f039febd (patch) | |
tree | 16b24baf37814f5fa8aebea6f32e9287d64b20f3 /container-core/src/main/java/com/yahoo/container/di/Container.java | |
parent | ceb337dea57c909ac83bc168e1b79872eae6dbfe (diff) |
Always return the set of bundles to uninstall upon completeGen,
regardless of success or failure.
Diffstat (limited to 'container-core/src/main/java/com/yahoo/container/di/Container.java')
-rw-r--r-- | container-core/src/main/java/com/yahoo/container/di/Container.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/di/Container.java b/container-core/src/main/java/com/yahoo/container/di/Container.java index c34e393ac02..a3e690df258 100644 --- a/container-core/src/main/java/com/yahoo/container/di/Container.java +++ b/container-core/src/main/java/com/yahoo/container/di/Container.java @@ -73,7 +73,7 @@ public class Container { ComponentGraph newGraph; Collection<Bundle> obsoleteBundles = new HashSet<>(); try { - newGraph = waitForNewConfigGenAndCreateGraph(oldGraph, fallbackInjector, isInitializing, obsoleteBundles); + newGraph = waitForNewConfigGenAndCreateGraph(oldGraph, fallbackInjector, isInitializing); newGraph.reuseNodes(oldGraph); } catch (Throwable t) { log.warning("Failed to set up component graph - uninstalling latest bundles. Bootstrap generation: " + getBootstrapGeneration()); @@ -89,9 +89,8 @@ public class Container { deconstructFailedGraph(oldGraph, newGraph, newBundlesFromFailedGen); throw e; } - // TODO: take obsoleteBundles as return value here! - osgi.completeBundleGeneration(Osgi.GenerationStatus.SUCCESS); - Runnable cleanupTask = createPreviousGraphDeconstructionTask(oldGraph, newGraph, obsoleteBundles); + Collection<Bundle> unusedBundlesFromPreviousGen = osgi.completeBundleGeneration(Osgi.GenerationStatus.SUCCESS); + Runnable cleanupTask = createPreviousGraphDeconstructionTask(oldGraph, newGraph, unusedBundlesFromPreviousGen); return new ComponentGraphResult(newGraph, cleanupTask); } catch (Throwable t) { invalidateGeneration(oldGraph.generation(), t); @@ -108,7 +107,7 @@ public class Container { } private ComponentGraph waitForNewConfigGenAndCreateGraph( - ComponentGraph graph, Injector fallbackInjector, boolean isInitializing, Collection<Bundle> obsoleteBundles) // NOTE: Return value + ComponentGraph graph, Injector fallbackInjector, boolean isInitializing) { ConfigSnapshot snapshot; while (true) { @@ -132,8 +131,7 @@ public class Container { } else { throwIfPlatformBundlesChanged(snapshot); } - Collection<Bundle> bundlesToRemove = installApplicationBundles(snapshot.configs()); - obsoleteBundles.addAll(bundlesToRemove); + installApplicationBundles(snapshot.configs()); graph = createComponentGraph(snapshot.configs(), getBootstrapGeneration(), fallbackInjector); @@ -203,9 +201,9 @@ public class Container { return () -> destructor.deconstruct(oldGraph.generation(), obsoleteComponents, obsoleteBundles); } - private Set<Bundle> installApplicationBundles(Map<ConfigKey<? extends ConfigInstance>, ConfigInstance> configsIncludingBootstrapConfigs) { + private void installApplicationBundles(Map<ConfigKey<? extends ConfigInstance>, ConfigInstance> configsIncludingBootstrapConfigs) { ApplicationBundlesConfig applicationBundlesConfig = getConfig(applicationBundlesConfigKey, configsIncludingBootstrapConfigs); - return osgi.useApplicationBundles(applicationBundlesConfig.bundles(), getBootstrapGeneration()); + osgi.useApplicationBundles(applicationBundlesConfig.bundles(), getBootstrapGeneration()); } private ComponentGraph createComponentGraph(Map<ConfigKey<? extends ConfigInstance>, ConfigInstance> configsIncludingBootstrapConfigs, |