Github user ahgittin commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/899#discussion_r152285416
--- Diff:
core/src/main/java/org/apache/brooklyn/core/mgmt/ha/OsgiArchiveInstaller.java
---
@@ -437,13 +463,19 @@ private synchronized void close() {
}
} else {
// No such Brooklyn-managed bundle.
-
+
// Check if likely-looking bundle already installed to
OSGi subsystem, but brooklyn not aware of it.
// This will often happen on a karaf restart where bundle
was cached by karaf, so we need to allow it;
// can also happen if brooklyn.libraries references an
existing bundle.
//
// If we're not certain that the bundle is identical
+ // First check if this bundle is forcibly removed (and
optionally upgraded).
+ // If so, don't install it - return the replacement, if
any.
+ Maybe<VersionedName> forcedReplacementBundle =
CatalogUpgrades.tryGetBundleForcedReplaced(mgmt(),
inferredMetadata.getVersionedName());
+ if (forcedReplacementBundle.isPresent()) {
+ return
generateForciblyRemovedResult(inferredMetadata.getVersionedName(),
Optional.fromNullable(forcedReplacementBundle.get()));
--- End diff --
suggest pass `Maybe` in second argument, ie `forcedReplacementBundle`, and
use `Maybe.isPresentAndNotNull()`
---