You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by iu...@apache.org on 2021/07/15 16:03:51 UTC

[brooklyn-server] branch master updated: Solved reference being discarded and not used issue

This is an automated email from the ASF dual-hosted git repository.

iuliana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git


The following commit(s) were added to refs/heads/master by this push:
     new 14a9ef3  Solved reference being discarded and not used issue
     new 9fe47ec  Merge pull request #1203 from iuliana/fix/reference-lost
14a9ef3 is described below

commit 14a9ef3b37fa3d052fe5c9136a0e02ff47d61bd9
Author: iuliana <iu...@cloudsoft.io>
AuthorDate: Thu Jul 15 16:57:46 2021 +0100

    Solved reference being discarded and not used issue
---
 .../brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java     | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java
index d13804f..5960fb8a 100644
--- a/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java
+++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/ha/HighAvailabilityManagerImpl.java
@@ -1020,7 +1020,9 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
     }
 
     private void updateLastManagementPlaneSyncRecordWithLocalKnowledge() {
-        if (lastSyncRecord != null) updateManagementPlaneSyncRecordWithLocalKnowledge(lastSyncRecord);
+        if (lastSyncRecord != null) {
+            lastSyncRecord = updateManagementPlaneSyncRecordWithLocalKnowledge(lastSyncRecord);
+        }
     }
 
     @Override
@@ -1054,7 +1056,7 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
                 ManagementPlaneSyncRecord result = persister.loadSyncRecord(managementContext.getBrooklynProperties().getConfig(TIMEOUT_FOR_INACTIVE_NODE_REMOVAL_ON_STARTUP));
                 
                 if (useLocalKnowledgeForThisNode) {
-                    updateManagementPlaneSyncRecordWithLocalKnowledge(result);
+                    result = updateManagementPlaneSyncRecordWithLocalKnowledge(result);
                 }
                 
                 if (i>0) {
@@ -1076,7 +1078,7 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
         throw new IllegalStateException(message, lastException);
     }
 
-    private void updateManagementPlaneSyncRecordWithLocalKnowledge(ManagementPlaneSyncRecord result) {
+    private ManagementPlaneSyncRecord  updateManagementPlaneSyncRecordWithLocalKnowledge(ManagementPlaneSyncRecord result) {
         // Report this node's most recent state, and detect AWOL nodes
         ManagementNodeSyncRecord me = BasicManagementNodeSyncRecord.builder()
                 .from(result.getManagementNodes().get(ownNodeId), true)
@@ -1092,7 +1094,7 @@ public class HighAvailabilityManagerImpl implements HighAvailabilityManager {
         if (getTransitionTargetNodeState() == ManagementNodeState.MASTER) {
             builder.masterNodeId(ownNodeId);
         }
-        result = builder.build();
+        return builder.build();
     }
 
     protected ManagementNodeSyncRecord createManagementNodeSyncRecord(boolean useLocalTimestampAsRemoteTimestamp) {