summaryrefslogtreecommitdiffstats
path: root/jdisc_core
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2022-08-31 09:04:37 +0200
committerGitHub <noreply@github.com>2022-08-31 09:04:37 +0200
commita9459aeb4ad638ba05a90d3f8e8de24c3df47f9c (patch)
treebc79bd8e8b48a8a9078c5f3199a958cbf031f202 /jdisc_core
parentfd775ea947dbbadd3190764e16b04b13f0777ac3 (diff)
parentf68b1f92937d495ce968d07ae7e7212b0e3cce47 (diff)
Merge pull request #23847 from vespa-engine/cleanup-after-failed-component-graph_rebased
Cleanup after failed component graph [run-systemtest]
Diffstat (limited to 'jdisc_core')
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/application/OsgiFramework.java2
-rw-r--r--jdisc_core/src/main/java/com/yahoo/jdisc/core/BundleCollisionHook.java11
2 files changed, 6 insertions, 7 deletions
diff --git a/jdisc_core/src/main/java/com/yahoo/jdisc/application/OsgiFramework.java b/jdisc_core/src/main/java/com/yahoo/jdisc/application/OsgiFramework.java
index 438ad8d8ebe..f8c158ab178 100644
--- a/jdisc_core/src/main/java/com/yahoo/jdisc/application/OsgiFramework.java
+++ b/jdisc_core/src/main/java/com/yahoo/jdisc/application/OsgiFramework.java
@@ -94,7 +94,7 @@ public interface OsgiFramework {
* Allows this framework to install duplicates of the given collection of bundles. Duplicate detection
* is handled by the {@link com.yahoo.jdisc.core.BundleCollisionHook}.
*
- * @param bundles The bundles to allow duplicates of
+ * @param bundles The bundles to allow duplicates of. An empty collection will prohibit any duplicates.
*/
void allowDuplicateBundles(Collection<Bundle> bundles);
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 6b57b1e90e7..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
@@ -31,10 +31,10 @@ import java.util.stream.Collectors;
* @author gjoranv
*/
public class BundleCollisionHook implements CollisionHook, EventHook, FindHook {
- private static Logger log = Logger.getLogger(BundleCollisionHook.class.getName());
+ 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));
}
@@ -90,7 +89,7 @@ public class BundleCollisionHook implements CollisionHook, EventHook, FindHook {
/**
* Filters out the set of bundles that should not be visible to the bundle associated with the given context.
* If the given context represents one of the allowed duplicates, this method filters out all bundles
- * that are duplicates of the allowed duplicates. Otherwise this method filters out the allowed duplicates,
+ * that are duplicates of the allowed duplicates. Otherwise, this method filters out the allowed duplicates,
* so they are not visible to other bundles.
*/
@Override