diff options
author | gjoranv <gv@verizonmedia.com> | 2022-08-31 14:11:38 +0200 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2022-08-31 14:11:38 +0200 |
commit | f869fa7fc3fbce76bc19745201bb62484dfc8efe (patch) | |
tree | b8d8e622116ef172e43395f6c9671504f2a740d4 /jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java | |
parent | 60e7b087648bc3c5fa4c4a06ca75f740e176f9d5 (diff) |
Revert "Clean up bundles and allowed duplicates after a failed reconfig."
This reverts commit b0a398eaeadfaf12e31bcfef2e41892439db1149.
Diffstat (limited to 'jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java')
-rw-r--r-- | jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java b/jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java index 3212bb4e6de..2f90b4e067f 100644 --- a/jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java +++ b/jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java @@ -34,7 +34,7 @@ public class BundleCollisionHook implements CollisionHook, EventHook, FindHook { private static final Logger log = Logger.getLogger(BundleCollisionHook.class.getName()); private ServiceRegistration<?> registration; - private final Map<Bundle, BsnVersion> allowedDuplicates = new HashMap<>(5); + private Map<Bundle, BsnVersion> allowedDuplicates = new HashMap<>(5); public void start(BundleContext context) { if (registration != null) { @@ -50,10 +50,11 @@ public class BundleCollisionHook implements CollisionHook, EventHook, FindHook { } /** - * Sets a collection of bundles to allow duplicates for. + * Adds a collection of bundles to the allowed duplicates. + * Also clears any previous allowed duplicates of the new allowed duplicates. */ synchronized void allowDuplicateBundles(Collection<Bundle> bundles) { - allowedDuplicates.clear(); + allowedDuplicates.values().removeAll(bundles.stream().map(BsnVersion::new).collect(Collectors.toSet())); for (var bundle : bundles) { allowedDuplicates.put(bundle, new BsnVersion(bundle)); } |