Github user bostko commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/272#discussion_r71941059
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/mgmt/rebind/transformer/impl/DeleteOrphanedStateTransformer.java
 ---
    @@ -64,12 +68,24 @@ protected 
DeleteOrphanedStateTransformer(DeleteOrphanedStateTransformer.Builder
             super(builder);
         }
     
    +    /**
    +     * We inspect the state in two different ways to find the entities 
that will be deleted:
    +     * belt-and-braces! Only if the state is not referenced by either of 
those two approaches
    +     * will we delete it.
    +     */
         @Override
         public BrooklynMementoRawData transform(BrooklynMementoRawData input) {
    -        Map<String, String> locationsToKeep = findLocationsToKeep(input);
    -        Map<String, String> enrichersToKeep = 
copyRetainingKeys(input.getEnrichers(), findAllReferencedEnrichers(input));
    -        Map<String, String> policiesToKeep = 
copyRetainingKeys(input.getPolicies(), findAllReferencedPolicies(input));
    -        Map<String, String> feedsToKeep = 
copyRetainingKeys(input.getFeeds(), findAllReferencedFeeds(input));
    +        ReferencedState stateReferencedFromXpath = new 
ReachabilityXpathInspector().inspect(input);
    +        ReferencedState stateToKeepFromGrep = new 
ReachabilityGrepInspector().inspect(input);
    --- End diff --
    
    Isn't it better if `ReachabilityGrepInspector` is after `locationsToKeep`, 
`enrichersToKeep`, `policiesToKeep`, `feedsToKeep` are produced.
    This way it could also grep inside those for any references.


---
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.
---

Reply via email to