summaryrefslogtreecommitdiffstats
path: root/container-core
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2020-04-16 15:33:23 +0200
committergjoranv <gv@verizonmedia.com>2020-04-16 23:33:37 +0200
commit2edf1c5bf34faca8e2e3c508b7f9f57697039c13 (patch)
treead08075d0176f0c7592d461271265082890f6aac /container-core
parent1939d85100f86c4aa01385716b4d1e971cf3f845 (diff)
Simplify code flow by getting obsolete file refs from one place.
Diffstat (limited to 'container-core')
-rw-r--r--container-core/src/main/java/com/yahoo/container/core/config/BundleLoader.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/core/config/BundleLoader.java b/container-core/src/main/java/com/yahoo/container/core/config/BundleLoader.java
index 559b4a28788..3497cf45c75 100644
--- a/container-core/src/main/java/com/yahoo/container/core/config/BundleLoader.java
+++ b/container-core/src/main/java/com/yahoo/container/core/config/BundleLoader.java
@@ -160,9 +160,8 @@ public class BundleLoader {
/**
* Cleans up the map of active file references
*/
- private void removeInactiveFileReferences(List<FileReference> newReferences) {
+ private void removeInactiveFileReferences(Set<FileReference> fileReferencesToRemove) {
// Clean up the map of active bundles
- Set<FileReference> fileReferencesToRemove = getObsoleteFileReferences(newReferences);
fileReferencesToRemove.forEach(reference2Bundles::remove);
}
@@ -174,9 +173,7 @@ public class BundleLoader {
* bundles installed on the node, and not transferred via file distribution).
* Such bundles will never have duplicates because they always have the same location id.
*/
- private void allowDuplicateBundles(List<FileReference> newReferences) {
- Set<FileReference> obsoleteReferences = getObsoleteFileReferences(newReferences);
-
+ private void allowDuplicateBundles(Set<FileReference> obsoleteReferences) {
// The bundle at index 0 for each file reference always corresponds to the bundle at the file reference location
Set<Bundle> allowedDuplicates = obsoleteReferences.stream()
.filter(reference -> ! isDiskBundle(reference))
@@ -207,8 +204,9 @@ public class BundleLoader {
// Must be done before allowing duplicates because allowed duplicates affect osgi.getCurrentBundles
Set<Bundle> bundlesToUninstall = getObsoleteBundles(newBundles);
- allowDuplicateBundles(newBundles);
- removeInactiveFileReferences(newBundles);
+ Set<FileReference> obsoleteReferences = getObsoleteFileReferences(newBundles);
+ allowDuplicateBundles(obsoleteReferences);
+ removeInactiveFileReferences(obsoleteReferences);
install(newBundles);
startBundles();