You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by GitBox <gi...@apache.org> on 2022/06/13 11:38:23 UTC

[GitHub] [brooklyn-server] jcabrerizo commented on a diff in pull request #1320: Introduce entity adjunct proxy, fix deserialization edge case

jcabrerizo commented on code in PR #1320:
URL: https://github.com/apache/brooklyn-server/pull/1320#discussion_r895612711


##########
core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/RebindIteration.java:
##########
@@ -484,11 +483,23 @@ protected void instantiateLocationsAndEntities() {
         }
     }
 
+    protected Map<String,EntityAdjunct> adjunctProxies = MutableMap.of();
+    protected <T extends EntityAdjunct> T createAdjunctProxy(Class<T> adjunctType, String id) {
+        return (T) adjunctProxies.computeIfAbsent(id, (id2) -> EntityAdjuncts.createProxy(adjunctType, null) );
+    }
+
     protected void instantiateMementos() throws IOException {
 
         checkEnteringPhase(4);
 
+        if (!adjunctProxies.isEmpty()) {
+            LOG.warn("Had stale adjunct information when rebinding; ignoring: "+adjunctProxies);
+        }
+        adjunctProxies.clear();
+

Review Comment:
   Clear is only need if is not empty, moving this inside the exiting `if` above will be a minor improve



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@brooklyn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org