summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2020-07-17 22:34:00 +0200
committergjoranv <gv@verizonmedia.com>2020-07-17 22:34:00 +0200
commit030ef404f8b65fdc469abff0b0a77498fee4837c (patch)
tree3cd11eccc9caf555b006291fa9ad8f67e86a55f5
parentc8f2ce298a6a7514e4b37940bf53d4771f0c402a (diff)
Ignore later calls to add or alter the set of platform bundles.
-rw-r--r--container-core/src/main/java/com/yahoo/container/core/config/PlatformBundleLoader.java25
1 files changed, 20 insertions, 5 deletions
diff --git a/container-core/src/main/java/com/yahoo/container/core/config/PlatformBundleLoader.java b/container-core/src/main/java/com/yahoo/container/core/config/PlatformBundleLoader.java
index 28428391a33..c6bc52d5c31 100644
--- a/container-core/src/main/java/com/yahoo/container/core/config/PlatformBundleLoader.java
+++ b/container-core/src/main/java/com/yahoo/container/core/config/PlatformBundleLoader.java
@@ -10,8 +10,13 @@ import java.util.Set;
import java.util.logging.Logger;
/**
- * Installs all platform bundles, using the {@link DiskBundleInstaller}.
+ * Used to install the bundles that are added as platform bundles by the config-model.
+ *
* All platform bundles reside on disk, and they are never uninstalled.
+ * Platform bundles are allowed to pre-install other bundles on disk via the
+ * X-JDisc-Preinstall-Bundle manifest header.
+ *
+ * After the first time, attempts to install additional bundles should be a NOP.
*
* @author gjoranv
*/
@@ -21,6 +26,9 @@ public class PlatformBundleLoader {
private final Osgi osgi;
private final DiskBundleInstaller installer;
+ private Set<Bundle> installedBundles;
+ private boolean hasLoadedBundles = false;
+
public PlatformBundleLoader(Osgi osgi) {
this(osgi, new DiskBundleInstaller());
}
@@ -31,21 +39,28 @@ public class PlatformBundleLoader {
}
public void useBundles(List<FileReference> fileReferences) {
- Set<Bundle> installedBundles = install(fileReferences);
+ if (hasLoadedBundles) {
+ log.fine(() -> "Platform bundles have already been installed." +
+ "\nInstalled bundles: " + installedBundles +
+ "\nGiven files: " + fileReferences);
+ return;
+ }
+ installedBundles = install(fileReferences);
BundleStarter.startBundles(installedBundles);
+ hasLoadedBundles = true;
}
private Set<Bundle> install(List<FileReference> bundlesToInstall) {
- var installedBundles = new LinkedHashSet<Bundle>();
+ var allInstalled = new LinkedHashSet<Bundle>();
for (FileReference reference : bundlesToInstall) {
try {
- installedBundles.addAll(installBundleFromDisk(reference));
+ allInstalled.addAll(installBundleFromDisk(reference));
}
catch(Exception e) {
throw new RuntimeException("Could not install bundle '" + reference + "'", e);
}
}
- return installedBundles;
+ return allInstalled;
}
private List<Bundle> installBundleFromDisk(FileReference reference) {