You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2021/09/14 21:56:44 UTC
[brooklyn-server] 25/27: fix a few more readonly/rebind logs and
exclusions
This is an automated email from the ASF dual-hosted git repository.
heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit 1d99b34816dca8d1e803cfcff6ac09040b460b38
Author: Alex Heneveld <al...@cloudsoftcorp.com>
AuthorDate: Tue Sep 14 22:12:27 2021 +0100
fix a few more readonly/rebind logs and exclusions
---
.../brooklyn/core/entity/AbstractEntity.java | 32 +++++++++++-----------
.../brooklyn/core/feed/AttributePollHandler.java | 27 ++++++++++--------
2 files changed, 32 insertions(+), 27 deletions(-)
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
index b796f61..fe2a8d9 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
@@ -924,7 +924,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject implements E
return sensors().get(attribute);
}
- static Set<String> WARNED_READ_ONLY_ATTRIBUTES = Collections.synchronizedSet(MutableSet.<String>of());
+ private static Set<String> LOGGED_PROMINENT_READ_ONLY_ATTRIBUTES = Collections.synchronizedSet(MutableSet.<String>of());
// -------- CONFIGURATION --------------
@@ -971,33 +971,33 @@ public abstract class AbstractEntity extends AbstractBrooklynObject implements E
if (Equals.approximately(val, oldVal)) {
// ignore, probably an enricher resetting values or something on init
} else {
- String message = AbstractEntity.this+" setting "+attribute+" = "+val+" (was "+oldVal+") in read only mode; will have very little effect";
+ String message = AbstractEntity.this+" setting "+attribute+" = "+val+" (was "+oldVal+") in read only mode; will not be persisted or published";
if (!getManagementSupport().isDeployed()) {
if (getManagementSupport().wasDeployed()) message += " (no longer deployed)";
else message += " (not yet deployed)";
}
- if (WARNED_READ_ONLY_ATTRIBUTES.add(attribute.getName())) {
- LOG.warn(message + " (future messages for this sensor logged at trace)");
+ if (LOGGED_PROMINENT_READ_ONLY_ATTRIBUTES.add(attribute.getName())) {
+ LOG.info(message + " (future messages for this sensor logged at trace)");
} else if (LOG.isTraceEnabled()) {
LOG.trace(message);
}
}
- }
- T result = attributesInternal.update(attribute, val);
- if (!Entities.isReadOnly(AbstractEntity.this)) {
// suppress notifications if read only
+ return attributesInternal.updateInternalWithoutLockOrPublish(attribute, val);
+ }
- if (result == null) {
- // could be this is a new sensor
- entityType.addSensorIfAbsent(attribute);
- }
+ T result = attributesInternal.update(attribute, val);
- if (!Objects.equal(result, val)) {
- getManagementSupport().getEntityChangeListener().onAttributeChanged(attribute);
- }
+ if (result == null) {
+ // could be this is a new sensor
+ entityType.addSensorIfAbsent(attribute);
}
-
+
+ if (!Objects.equal(result, val)) {
+ getManagementSupport().getEntityChangeListener().onAttributeChanged(attribute);
+ }
+
return result;
}
@@ -1032,7 +1032,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject implements E
if (getManagementSupport().wasDeployed()) message += " (no longer deployed)";
else message += " (not yet deployed)";
}
- if (WARNED_READ_ONLY_ATTRIBUTES.add(attribute.getName())) {
+ if (LOGGED_PROMINENT_READ_ONLY_ATTRIBUTES.add(attribute.getName())) {
LOG.warn(message + " (future messages for this sensor logged at trace)");
} else if (LOG.isTraceEnabled()) {
LOG.trace(message);
diff --git a/core/src/main/java/org/apache/brooklyn/core/feed/AttributePollHandler.java b/core/src/main/java/org/apache/brooklyn/core/feed/AttributePollHandler.java
index 0377eed..c599169 100644
--- a/core/src/main/java/org/apache/brooklyn/core/feed/AttributePollHandler.java
+++ b/core/src/main/java/org/apache/brooklyn/core/feed/AttributePollHandler.java
@@ -158,13 +158,13 @@ public class AttributePollHandler<V> implements PollHandler<V> {
if (!lastWasProblem) {
if (expiryTime <= nowTime) {
currentProblemLoggedAsWarning = true;
- if (entity==null || !Entities.isNoLongerManaged(entity)) {
+ if (entity==null || Entities.isManagedActive(entity)) {
log.warn("Read of " + getBriefDescription() + " gave " + type + ": " + val);
+ if (log.isDebugEnabled() && val instanceof Throwable)
+ log.debug("Trace for "+type+" reading "+getBriefDescription()+": "+val, (Throwable)val);
} else {
- log.debug("Read of " + getBriefDescription() + " gave " + type + ": " + val);
+ log.debug("Read (unmanaged) of " + getBriefDescription() + " gave " + type + ": " + val);
}
- if (log.isDebugEnabled() && val instanceof Throwable)
- log.debug("Trace for "+type+" reading "+getBriefDescription()+": "+val, (Throwable)val);
} else {
if (log.isDebugEnabled())
log.debug("Read of " + getBriefDescription() + " gave " + type + " (in grace period): " + val);
@@ -174,13 +174,18 @@ public class AttributePollHandler<V> implements PollHandler<V> {
} else {
if (expiryTime <= nowTime) {
currentProblemLoggedAsWarning = true;
- log.warn("Read of " + getBriefDescription() + " gave " + type +
- " (grace period expired, occurring for "+Duration.millis(nowTime - currentProblemStartTimeCache)+
- (config.hasExceptionHandler() ? "" : ", no exception handler set for sensor")+
- ")"+
- ": " + val);
- if (log.isDebugEnabled() && val instanceof Throwable)
- log.debug("Trace for "+type+" reading "+getBriefDescription()+": "+val, (Throwable)val);
+ if (entity==null || Entities.isManagedActive(entity)) {
+ log.warn("Read of " + getBriefDescription() + " gave " + type +
+ " (grace period expired, occurring for " + Duration.millis(nowTime - currentProblemStartTimeCache) +
+ (config.hasExceptionHandler() ? "" : ", no exception handler set for sensor") +
+ ")" +
+ ": " + val);
+ if (log.isDebugEnabled() && val instanceof Throwable)
+ log.debug("Trace for " + type + " reading " + getBriefDescription() + ": " + val, (Throwable) val);
+ } else {
+ if (log.isDebugEnabled())
+ log.debug("Read (unmanaged) of " + getBriefDescription() + " gave " + type + " (grace period expired): " + val);
+ }
} else {
if (log.isDebugEnabled())
log.debug("Recurring {} reading {} in {} (still in grace period): {}", new Object[] {type, this, getBriefDescription(), val});