curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dragonsi...@apache.org
Subject [1/2] git commit: Performance fix in processChildren()
Date Thu, 30 Oct 2014 07:42:20 GMT
Repository: curator
Updated Branches:
  refs/heads/master 1c194b426 -> 3e4626237


Performance fix in processChildren()


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/bea6b80e
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/bea6b80e
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/bea6b80e

Branch: refs/heads/master
Commit: bea6b80ec2622251156143b45c49a7f7871082cd
Parents: 86299ed
Author: Leon Stein <lstein@ebay.com>
Authored: Fri Oct 3 17:09:27 2014 -0400
Committer: Leon Stein <lstein@ebay.com>
Committed: Fri Oct 3 17:09:27 2014 -0400

----------------------------------------------------------------------
 .../framework/recipes/cache/PathChildrenCache.java  | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/bea6b80e/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
index f499562..71d83fe 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
@@ -646,20 +646,10 @@ public class PathChildrenCache implements Closeable
 
     private void processChildren(List<String> children, RefreshMode mode) throws Exception
     {
-        List<String> fullPaths = Lists.newArrayList(Lists.transform
-            (
-                children,
-                new Function<String, String>()
-                {
-                    @Override
-                    public String apply(String child)
-                    {
-                        return ZKPaths.makePath(path, child);
-                    }
-                }
-            ));
         Set<String> removedNodes = Sets.newHashSet(currentData.keySet());
-        removedNodes.removeAll(fullPaths);
+        for ( String child : children ) {
+            removedNodes.remove(ZKPaths.makePath(path, child));
+        }
 
         for ( String fullPath : removedNodes )
         {


Mime
View raw message