diff options
author | gjoranv <gv@verizonmedia.com> | 2022-09-01 08:43:56 +0200 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2022-09-01 08:43:56 +0200 |
commit | cf928294be0c0d3a5be9137f4882fe02db6986ac (patch) | |
tree | 9ccccc9ae351e5fcee87f69d4c18c969de7ef65d /jdisc_core/src/main/java/com/yahoo/jdisc/core | |
parent | 35e134e209ac8cec8d4643e1eee691a6e3f32bdf (diff) |
Reapply "Clean up bundles and allowed duplicates after a failed reconfig."
This reverts commit f869fa7fc3fbce76bc19745201bb62484dfc8efe.
Diffstat (limited to 'jdisc_core/src/main/java/com/yahoo/jdisc/core')
-rw-r--r-- | jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java | 7 |
1 files changed, 3 insertions, 4 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 2f90b4e067f..3212bb4e6de 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 Map<Bundle, BsnVersion> allowedDuplicates = new HashMap<>(5); + private final Map<Bundle, BsnVersion> allowedDuplicates = new HashMap<>(5); public void start(BundleContext context) { if (registration != null) { @@ -50,11 +50,10 @@ public class BundleCollisionHook implements CollisionHook, EventHook, FindHook { } /** - * Adds a collection of bundles to the allowed duplicates. - * Also clears any previous allowed duplicates of the new allowed duplicates. + * Sets a collection of bundles to allow duplicates for. */ synchronized void allowDuplicateBundles(Collection<Bundle> bundles) { - allowedDuplicates.values().removeAll(bundles.stream().map(BsnVersion::new).collect(Collectors.toSet())); + allowedDuplicates.clear(); for (var bundle : bundles) { allowedDuplicates.put(bundle, new BsnVersion(bundle)); } |