diff options
5 files changed, 10 insertions, 7 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java b/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java index 3fd8b8dc6a9..8b720f0d48f 100644 --- a/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java +++ b/container-core/src/main/java/com/yahoo/container/core/config/HandlersConfigurerDi.java @@ -98,8 +98,8 @@ public class HandlersConfigurerDi { } @Override - public Set<Bundle> useApplicationBundles(Collection<FileReference> bundles) { - log.info("Installing bundles from the latest application."); + public Set<Bundle> useApplicationBundles(Collection<FileReference> bundles, long generation) { + log.info("Installing bundles for application generation " + generation); return applicationBundleLoader.useBundles(new ArrayList<>(bundles)); } 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 db463edecc0..b1bf45290df 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 @@ -194,7 +194,7 @@ public class Container { private Set<Bundle> installApplicationBundles(Map<ConfigKey<? extends ConfigInstance>, ConfigInstance> configsIncludingBootstrapConfigs) { ApplicationBundlesConfig applicationBundlesConfig = getConfig(applicationBundlesConfigKey, configsIncludingBootstrapConfigs); - return osgi.useApplicationBundles(applicationBundlesConfig.bundles()); + return osgi.useApplicationBundles(applicationBundlesConfig.bundles(), getComponentsGeneration()); } private ComponentGraph createComponentGraph(Map<ConfigKey<? extends ConfigInstance>, ConfigInstance> configsIncludingBootstrapConfigs, diff --git a/container-core/src/main/java/com/yahoo/container/di/Osgi.java b/container-core/src/main/java/com/yahoo/container/di/Osgi.java index 02f42fdb9b8..73d39c50f02 100644 --- a/container-core/src/main/java/com/yahoo/container/di/Osgi.java +++ b/container-core/src/main/java/com/yahoo/container/di/Osgi.java @@ -28,10 +28,14 @@ public interface Osgi { } /** - * Returns the set of bundles that is not used by the current application generation, + * Returns the set of bundles that is not needed by the new application generation, * and therefore should be scheduled for uninstalling. + * + * @param bundles The bundles for the new application. + * @param generation The generation number of the new application. + * @return the set of bundles that is not needed by the new application generation, */ - default Set<Bundle> useApplicationBundles(Collection<FileReference> bundles) { + default Set<Bundle> useApplicationBundles(Collection<FileReference> bundles, long generation) { return emptySet(); } diff --git a/container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java b/container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java index 2236a1b250a..7f223b0f5a0 100644 --- a/container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java +++ b/container-core/src/test/java/com/yahoo/container/core/config/ApplicationBundleLoaderTest.java @@ -128,7 +128,6 @@ public class ApplicationBundleLoaderTest { assertEquals(0, bundlesToUninstall.size()); assertEquals(1, osgi.getCurrentBundles().size()); - bundleLoader.useBundles(List.of(BUNDLE_1_REF)); obsoleteBundles = bundleLoader.useBundles(List.of(BUNDLE_1_REF)); assertTrue(obsoleteBundles.isEmpty()); assertEquals(1, osgi.getCurrentBundles().size()); diff --git a/container-core/src/test/java/com/yahoo/container/core/config/TestOsgi.java b/container-core/src/test/java/com/yahoo/container/core/config/TestOsgi.java index 0df338c2144..b48aae2e300 100644 --- a/container-core/src/test/java/com/yahoo/container/core/config/TestOsgi.java +++ b/container-core/src/test/java/com/yahoo/container/core/config/TestOsgi.java @@ -65,7 +65,7 @@ public class TestOsgi extends MockOsgi implements com.yahoo.container.di.Osgi { } @Override - public Set<Bundle> useApplicationBundles(Collection<FileReference> bundles) { + public Set<Bundle> useApplicationBundles(Collection<FileReference> bundles, long generation) { return bundleLoader.useBundles(new ArrayList<>(bundles)); } |