Github user dragonsinth commented on a diff in the pull request:
    --- Diff: 
    @@ -702,19 +687,18 @@ private TreeNode find(String findPath)
                 ImmutableMap.Builder<String, ChildData> builder = 
                 for ( Map.Entry<String, TreeNode> entry : map.entrySet() )
    -                TreeNode childNode = entry.getValue();
    -                ChildData childData = childNode.childData;
    -                // Double-check liveness after retreiving data.
    -                if ( childData != null && childNode.nodeState == 
NodeState.LIVE )
    +                ChildData childData = entry.getValue().childData;
    +                // Double-check liveness after retrieving data.
    +                if ( isLive(childData) )
    --- End diff --
    It's subtle, but the point I'm trying to make is that you have to read 
`.childData` exactly once, then check the liveness, then use only that value 
going forward.  It would be an error to remove the local variable here and 
reference `entry.getValue().childData` twice.
    It's a "double" check because _generally_ there shouldn't be any non-LIVE 
children in the parent `children` map that we're iterating.  But due to 
volatility we have to "double check" that child nodes read from the map are 
still alive after pulling `.childData`


Reply via email to