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 1de22e4409c441f59bfd52991666df98a58716dd
Author: Alex Heneveld <[email protected]>
AuthorDate: Fri Sep 10 13:32:15 2021 +0100

    catch problems when recording location usage, prevent mgmt node state 
changes from failing in this case
---
 .../core/mgmt/internal/LocalUsageManager.java        | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git 
a/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalUsageManager.java
 
b/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalUsageManager.java
index 41c5dc4..c4d6deb 100644
--- 
a/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalUsageManager.java
+++ 
b/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalUsageManager.java
@@ -288,8 +288,16 @@ public class LocalUsageManager implements UsageManager {
         // but no strong enough feelings yet...
         
         checkNotNull(loc, "location");
-        if (loc.getConfig(AbstractLocation.TEMPORARY_LOCATION)) {
-            log.info("Ignoring location lifecycle usage event for {} (state 
{}), because location is a temporary location", loc, state);
+        Boolean tempLocation = null;
+        try {
+            tempLocation = loc.getConfig(AbstractLocation.TEMPORARY_LOCATION);
+        } catch (Exception e) {
+            Exceptions.propagateIfFatal(e);
+            log.trace("Unable to get temporary location for {}", loc);
+        }
+
+        if (Boolean.TRUE.equals(tempLocation)) {
+            log.info("Ignoring location lifecycle usage event for {} (state 
{}), because location is a temporary location {}", loc, state, tempLocation);
             return;
         }
         checkNotNull(state, "state of location %s", loc);
@@ -302,7 +310,13 @@ public class LocalUsageManager implements UsageManager {
             return;
         }
         
-        Object callerContext = 
loc.getConfig(LocationConfigKeys.CALLER_CONTEXT);
+        Object callerContext = null;
+        try {
+            callerContext = loc.getConfig(LocationConfigKeys.CALLER_CONTEXT);
+        } catch (Exception e) {
+            Exceptions.propagateIfFatal(e);
+            log.trace("Unable to get caller context for {}", loc);
+        }
         
         if (callerContext != null && callerContext instanceof Entity) {
             Entity caller = (Entity) callerContext;

Reply via email to