[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-1962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14065450#comment-14065450
 ] 

Hongchao Deng commented on ZOOKEEPER-1962:
------------------------------------------

A few programming improvement suggestion:

h3. getting all the children

{code}
        for (int i = 0; i < allChildren.size(); i++) {
            current = allChildren.get(i);
            children = zk.getChildren(current, false);
            addParent(current, children, allChildren);
        }
{code}

Adding more items to _allChildren_ while looping it doesn't look a good way... 
I would suggest a recursive get would work. A future envision is that ZK core 
lib supports parallelized efficient recursive operations like get, delete.

h3. Path join
Add a path join abstraction instead of "+".
A way to work around this:
    
http://stackoverflow.com/questions/412380/combine-paths-in-java/412495#412495

h3. List join
Well.. A list join abstraction would make the code looks cleaner..
   https://code.google.com/p/guava-libraries/wiki/StringsExplained

Hope we could include [Guava|https://code.google.com/p/guava-libraries]. But it 
would be nice to define and use such abstraction in the code.



> Add a CLI command to recursively list a znode and children
> ----------------------------------------------------------
>
>                 Key: ZOOKEEPER-1962
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1962
>             Project: ZooKeeper
>          Issue Type: New Feature
>          Components: java client
>    Affects Versions: 3.4.6
>            Reporter: Gautam Gopalakrishnan
>            Assignee: Gautam Gopalakrishnan
>            Priority: Minor
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1962.diff
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> When troubleshooting applications where znodes can be multiple levels deep  
> (eg. HBase replication), it is handy to see all child znodes recursively 
> rather than run an ls for each node manually.
> So I propose adding an option to the "ls" command (-r) which will list all 
> child nodes under a given znode. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to