[
https://issues.apache.org/jira/browse/BOOKKEEPER-463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13538296#comment-13538296
]
Sijie Guo commented on BOOKKEEPER-463:
--------------------------------------
{quote}
Say that getChildrenInSingleNode returns a null pointer for the children list.
I believe ledgerListToSet will throw an exception (NPE) when trying to execute
the for loop.
{quote}
Clarify the concern here. getChildrenInSingleNode would thrown an IOException
when failed to fetch list from ZooKeeper. so no null list would be passed to
ledgerListToSet, no NPE.
{code}
+ public static List<String> getChildrenInSingleNode(final ZooKeeper zk,
final String node)
+ throws InterruptedException, IOException {
+ final GetChildrenCtx ctx = new GetChildrenCtx();
+ getChildrenInSingleNode(zk, node, new GenericCallback<List<String>>() {
+ @Override
+ public void operationComplete(int rc, List<String> ledgers) {
+ synchronized (ctx) {
+ if (Code.OK.intValue() == rc) {
+ ctx.children = ledgers;
+ }
+ ctx.rc = rc;
+ ctx.done = true;
+ ctx.notifyAll();
+ }
+ }
+ });
+
+ synchronized (ctx) {
+ while (ctx.done == false) {
+ ctx.wait();
+ }
+ }
+ if (Code.OK.intValue() != ctx.rc) {
+ throw new IOException("Error on getting children from node " +
node);
+ }
+ return ctx.children;
+
+ }
{code}
> Refactor garbage collection code for ease to plugin different GC algorithm.
> ---------------------------------------------------------------------------
>
> Key: BOOKKEEPER-463
> URL: https://issues.apache.org/jira/browse/BOOKKEEPER-463
> Project: Bookkeeper
> Issue Type: Sub-task
> Components: bookkeeper-server
> Reporter: Sijie Guo
> Assignee: Fangmin Lv
> Fix For: 4.2.0
>
> Attachments:
> 0001-BOOKKEEPER-463-Refactor-garbage-collection-code-for-.patch,
> BOOKKEEPER-463.patch, BOOKKEEPER-463.patch, BOOKKEEPER-463.patch,
> BOOKKEEPER-463.patch, BOOKKEEPER-463.patch, BOOKKEEPER-463.patch,
> BOOKKEEPER-463.patch, BOOKKEEPER-463.patch, BOOKKEEPER-463.patch
>
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira