diff options
author | gjoranv <gv@verizonmedia.com> | 2022-08-30 23:40:35 +0200 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2022-08-30 23:40:35 +0200 |
commit | f68b1f92937d495ce968d07ae7e7212b0e3cce47 (patch) | |
tree | a3f7acc1f23111b22bc5e6ecfa267dee5356e52b /container-core | |
parent | 41b9952b7f5b6062a6090ad5eb65d1aa3f8a9b84 (diff) |
Set duplicate bundles to the set of bundles from the failed generation.
Diffstat (limited to 'container-core')
2 files changed, 8 insertions, 5 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/core/config/ApplicationBundleLoader.java b/container-core/src/main/java/com/yahoo/container/core/config/ApplicationBundleLoader.java index 972d6677e3b..1e30b19a48d 100644 --- a/container-core/src/main/java/com/yahoo/container/core/config/ApplicationBundleLoader.java +++ b/container-core/src/main/java/com/yahoo/container/core/config/ApplicationBundleLoader.java @@ -71,8 +71,10 @@ public class ApplicationBundleLoader { bundlesFromNewGeneration.forEach(reference2Bundle::remove); Collection<Bundle> ret = bundlesFromNewGeneration.values(); - // No duplicate bundles should be allowed until the next call to useBundles. - osgi.allowDuplicateBundles(Set.of()); + // For correct operation of the CollisionHook (more specifically its FindHook implementation), the set of + // allowed duplicates must reflect the next set of bundles to uninstall, which is now the bundles from the + // failed generation. + osgi.allowDuplicateBundles(ret); // Clear restore info in case this method is called multiple times, for some reason. bundlesFromNewGeneration = Map.of(); 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 bc5b6d6069b..54ef2d41ac6 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 @@ -106,9 +106,10 @@ public class ApplicationBundleLoaderTest { assertEquals(1, bundlesToUninstall.size()); assertEquals(BUNDLE_2.getSymbolicName(), bundlesToUninstall.iterator().next().getSymbolicName()); - // Both bundles are still current, until the bundle from the failed gen will be uninstalled. - // Uninstalling is handled by the Deconstructor, not included in this test setup. - assertEquals(2, osgi.getCurrentBundles().size()); + // The bundle from the failed generation is not seen as current. It will still be installed, + // as uninstalling is handled by the Deconstructor, not included in this test setup. + assertEquals(1, osgi.getCurrentBundles().size()); + assertEquals(BUNDLE_1.getSymbolicName(), osgi.getCurrentBundles().get(0).getSymbolicName()); // Only the bundle-1 file reference is active, bundle-2 is removed. assertEquals(1, bundleLoader.getActiveFileReferences().size()); |