Github user nakomis commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/227#discussion_r69290194
--- Diff:
core/src/main/java/org/apache/brooklyn/core/BrooklynFeatureEnablement.java ---
@@ -182,27 +211,38 @@ public static boolean setEnablement(String property,
boolean val) {
synchronized (MUTEX) {
boolean oldVal = isEnabled(property);
FEATURE_ENABLEMENTS.put(property, val);
+
+ if (val == oldVal) {
+ LOG.debug("Enablement of "+property+" set to explicit
"+val+" (no-op as resolved to same value previously)");
+ } else {
+ LOG.debug("Enablement of "+property+" set to explicit
"+val+" (previously resolved to "+oldVal+")");
+ }
return oldVal;
}
}
public static void setDefault(String property, boolean val) {
synchronized (MUTEX) {
- if (!FEATURE_ENABLEMENTS.containsKey(property)) {
- String rawVal = System.getProperty(property);
- if (rawVal == null) {
- FEATURE_ENABLEMENTS.put(property, val);
- LOG.debug("Default enablement of "+property+" set to
"+val);
+ Boolean oldDefaultVal =
FEATURE_ENABLEMENT_DEFAULTS.get(property);
+ FEATURE_ENABLEMENT_DEFAULTS.put(property, val);
+ if (oldDefaultVal != null) {
+ if (oldDefaultVal.equals(val)) {
+ LOG.debug("Default enablement of "+property+" set to
"+val+" (no-op as same as previous default value)");
} else {
- LOG.debug("Not setting default enablement of
"+property+" to "+val+", because system property is "+rawVal);
+ LOG.debug("Default enablement of "+property+" set to
"+val+" (overwriting previous default of "+oldDefaultVal+")");
}
+ } else {
+ LOG.debug("Default enablement of "+property+" set to
"+val);
}
}
}
-
+
+ @VisibleForTesting
static void clearCache() {
synchronized (MUTEX) {
FEATURE_ENABLEMENTS.clear();
--- End diff --
Unrelated to this PR, but if `clearCache` is called, there is no mechanism
for downstream projects to re-add their defaults
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---