Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.0
    • Component/s: Client, Framework
    • Labels:
      None

      Description

      ZooKeeper 3.5 adds new versions of create() that return the Stat object of the newly created ZNode.

        Activity

        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/curator/pull/96

        Show
        githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/curator/pull/96
        Hide
        githubbot ASF GitHub Bot added a comment -

        Github user Randgalt commented on the pull request:

        https://github.com/apache/curator/pull/96#issuecomment-134392688

        +1

        Show
        githubbot ASF GitHub Bot added a comment - Github user Randgalt commented on the pull request: https://github.com/apache/curator/pull/96#issuecomment-134392688 +1
        Hide
        githubbot ASF GitHub Bot added a comment -

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

        https://github.com/apache/curator/pull/96#discussion_r37807339

        — Diff: curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java —
        @@ -520,12 +539,127 @@ public void processResult(int rc, String path, Object ctx, String name)
        }
        else

        { - sendBackgroundResponse(rc, path, ctx, name, operationAndData); + sendBackgroundResponse(rc, path, ctx, name, null, operationAndData); }

        }
        },
        backgrounding.getContext()
        );
        + }
        + else
        + {
        + client.getZooKeeper().create
        + (
        + operationAndData.getData().getPath(),
        + operationAndData.getData().getData(),
        + acling.getAclList(operationAndData.getData().getPath()),
        + createMode,
        + new AsyncCallback.Create2Callback() {
        +
        + @Override
        + public void processResult(int rc, String path, Object ctx, String name, Stat stat) {
        + trace.commit();
        +
        + //Need to manually populate the provided stat here.
        + storingStat.setAversion(stat.getAversion());
        — End diff –

        Yeah, this is the only place that it's done which is why I left it inline.

        Show
        githubbot ASF GitHub Bot added a comment - Github user cammckenzie commented on a diff in the pull request: https://github.com/apache/curator/pull/96#discussion_r37807339 — Diff: curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java — @@ -520,12 +539,127 @@ public void processResult(int rc, String path, Object ctx, String name) } else { - sendBackgroundResponse(rc, path, ctx, name, operationAndData); + sendBackgroundResponse(rc, path, ctx, name, null, operationAndData); } } }, backgrounding.getContext() ); + } + else + { + client.getZooKeeper().create + ( + operationAndData.getData().getPath(), + operationAndData.getData().getData(), + acling.getAclList(operationAndData.getData().getPath()), + createMode, + new AsyncCallback.Create2Callback() { + + @Override + public void processResult(int rc, String path, Object ctx, String name, Stat stat) { + trace.commit(); + + //Need to manually populate the provided stat here. + storingStat.setAversion(stat.getAversion()); — End diff – Yeah, this is the only place that it's done which is why I left it inline.
        Hide
        githubbot ASF GitHub Bot added a comment -

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

        https://github.com/apache/curator/pull/96#discussion_r37753815

        — Diff: curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java —
        @@ -520,12 +539,127 @@ public void processResult(int rc, String path, Object ctx, String name)
        }
        else

        { - sendBackgroundResponse(rc, path, ctx, name, operationAndData); + sendBackgroundResponse(rc, path, ctx, name, null, operationAndData); }

        }
        },
        backgrounding.getContext()
        );
        + }
        + else
        + {
        + client.getZooKeeper().create
        + (
        + operationAndData.getData().getPath(),
        + operationAndData.getData().getData(),
        + acling.getAclList(operationAndData.getData().getPath()),
        + createMode,
        + new AsyncCallback.Create2Callback() {
        +
        + @Override
        + public void processResult(int rc, String path, Object ctx, String name, Stat stat) {
        + trace.commit();
        +
        + //Need to manually populate the provided stat here.
        + storingStat.setAversion(stat.getAversion());
        — End diff –

        is this the only place this is done? Seems like a candidate for a utility.

        Show
        githubbot ASF GitHub Bot added a comment - Github user Randgalt commented on a diff in the pull request: https://github.com/apache/curator/pull/96#discussion_r37753815 — Diff: curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java — @@ -520,12 +539,127 @@ public void processResult(int rc, String path, Object ctx, String name) } else { - sendBackgroundResponse(rc, path, ctx, name, operationAndData); + sendBackgroundResponse(rc, path, ctx, name, null, operationAndData); } } }, backgrounding.getContext() ); + } + else + { + client.getZooKeeper().create + ( + operationAndData.getData().getPath(), + operationAndData.getData().getData(), + acling.getAclList(operationAndData.getData().getPath()), + createMode, + new AsyncCallback.Create2Callback() { + + @Override + public void processResult(int rc, String path, Object ctx, String name, Stat stat) { + trace.commit(); + + //Need to manually populate the provided stat here. + storingStat.setAversion(stat.getAversion()); — End diff – is this the only place this is done? Seems like a candidate for a utility.
        Hide
        githubbot ASF GitHub Bot added a comment -

        GitHub user cammckenzie opened a pull request:

        https://github.com/apache/curator/pull/96

        CURATOR-214 - Implemented new ZK API to allow Stat objects to be retu…

        …rned as part of the creation of a new ZNode.

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/apache/curator CURATOR-214

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/curator/pull/96.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #96


        commit af369dec7a3ba20c60c68b502198bd851e34906f
        Author: Cam McKenzie <cammckenzie@apache.org>
        Date: 2015-08-22T23:28:49Z

        CURATOR-214 - Implemented new ZK API to allow Stat objects to be returned as part of the creation of a new ZNode.


        Show
        githubbot ASF GitHub Bot added a comment - GitHub user cammckenzie opened a pull request: https://github.com/apache/curator/pull/96 CURATOR-214 - Implemented new ZK API to allow Stat objects to be retu… …rned as part of the creation of a new ZNode. You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/curator CURATOR-214 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/curator/pull/96.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #96 commit af369dec7a3ba20c60c68b502198bd851e34906f Author: Cam McKenzie <cammckenzie@apache.org> Date: 2015-08-22T23:28:49Z CURATOR-214 - Implemented new ZK API to allow Stat objects to be returned as part of the creation of a new ZNode.

          People

          • Assignee:
            cammckenzie Cameron McKenzie
            Reporter:
            randgalt Jordan Zimmerman
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development