You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by alexbrasetvik <gi...@git.apache.org> on 2015/08/03 01:32:36 UTC

[GitHub] curator pull request: CURATOR-241: Write updated data on reconnect

GitHub user alexbrasetvik opened a pull request:

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

    CURATOR-241: Write updated data on reconnect

    PersistentEphemeralNode can be initialised with certain data, then later updated. If the client reconnects, the replacing ephemeral should write the updated data.

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

    $ git pull https://github.com/alexbrasetvik/curator CURATOR-241

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

    https://github.com/apache/curator/pull/95.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 #95
    
----
commit 7fd4034e30f2ed3690226d2d78bf9f139df8b491
Author: Alex Brasetvik <al...@brasetvik.com>
Date:   2015-08-02T22:57:51Z

    CURATOR-241: Write updated data on reconnect
    
    PersistentEphemeralNode can be initialised with certain data, then
    later updated. If the client reconnects, the replacing ephemeral
    should write the updated data.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-241: Write updated data on reconnect

Posted by cammckenzie <gi...@git.apache.org>.
Github user cammckenzie commented on the pull request:

    https://github.com/apache/curator/pull/95#issuecomment-127091241
  
    Don't worry about squashing the commits. Thanks for the patch.
    
    +1 from me.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-241: Write updated data on reconnect

Posted by cammckenzie <gi...@git.apache.org>.
Github user cammckenzie commented on a diff in the pull request:

    https://github.com/apache/curator/pull/95#discussion_r36049932
  
    --- Diff: curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java ---
    @@ -338,10 +338,14 @@ public void setData(byte[] data) throws Exception
             this.data.set(Arrays.copyOf(data, data.length));
             if ( isActive() )
             {
    -            client.setData().inBackground().forPath(getActualPath(), this.data.get());
    +            client.setData().inBackground().forPath(getActualPath(), getData());
    --- End diff --
    
    Yeah, fair enough. Leave it as is, it's probably nicer to have the data accessed in the same way.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-241: Write updated data on reconnect

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

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


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-241: Write updated data on reconnect

Posted by cammckenzie <gi...@git.apache.org>.
Github user cammckenzie commented on a diff in the pull request:

    https://github.com/apache/curator/pull/95#discussion_r36049904
  
    --- Diff: curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java ---
    @@ -338,10 +338,14 @@ public void setData(byte[] data) throws Exception
             this.data.set(Arrays.copyOf(data, data.length));
             if ( isActive() )
             {
    -            client.setData().inBackground().forPath(getActualPath(), this.data.get());
    +            client.setData().inBackground().forPath(getActualPath(), getData());
             }
         }
     
    +    byte[] getData() {
    --- End diff --
    
    I'd mark it as private for now and it can be exposed later if needed. If it were to be for testing we mark these as @VisibleForTesting to be explicit as to why it's package protected.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-241: Write updated data on reconnect

Posted by alexbrasetvik <gi...@git.apache.org>.
Github user alexbrasetvik commented on a diff in the pull request:

    https://github.com/apache/curator/pull/95#discussion_r36049875
  
    --- Diff: curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java ---
    @@ -338,10 +338,14 @@ public void setData(byte[] data) throws Exception
             this.data.set(Arrays.copyOf(data, data.length));
             if ( isActive() )
             {
    -            client.setData().inBackground().forPath(getActualPath(), this.data.get());
    +            client.setData().inBackground().forPath(getActualPath(), getData());
             }
         }
     
    +    byte[] getData() {
    --- End diff --
    
    The idea was to make it available for future tests, but can make it private.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-241: Write updated data on reconnect

Posted by cammckenzie <gi...@git.apache.org>.
Github user cammckenzie commented on a diff in the pull request:

    https://github.com/apache/curator/pull/95#discussion_r36049780
  
    --- Diff: curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java ---
    @@ -338,10 +338,14 @@ public void setData(byte[] data) throws Exception
             this.data.set(Arrays.copyOf(data, data.length));
             if ( isActive() )
             {
    -            client.setData().inBackground().forPath(getActualPath(), this.data.get());
    +            client.setData().inBackground().forPath(getActualPath(), getData());
    --- End diff --
    
    I think that this change isn't required as the data is being accessed directly from within this method.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-241: Write updated data on reconnect

Posted by alexbrasetvik <gi...@git.apache.org>.
Github user alexbrasetvik commented on a diff in the pull request:

    https://github.com/apache/curator/pull/95#discussion_r36049886
  
    --- Diff: curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java ---
    @@ -338,10 +338,14 @@ public void setData(byte[] data) throws Exception
             this.data.set(Arrays.copyOf(data, data.length));
             if ( isActive() )
             {
    -            client.setData().inBackground().forPath(getActualPath(), this.data.get());
    +            client.setData().inBackground().forPath(getActualPath(), getData());
    --- End diff --
    
    Changed it so it was the same both places actually getting the data, but can revert this change. :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-241: Write updated data on reconnect

Posted by cammckenzie <gi...@git.apache.org>.
Github user cammckenzie commented on a diff in the pull request:

    https://github.com/apache/curator/pull/95#discussion_r36049773
  
    --- Diff: curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentEphemeralNode.java ---
    @@ -338,10 +338,14 @@ public void setData(byte[] data) throws Exception
             this.data.set(Arrays.copyOf(data, data.length));
             if ( isActive() )
             {
    -            client.setData().inBackground().forPath(getActualPath(), this.data.get());
    +            client.setData().inBackground().forPath(getActualPath(), getData());
             }
         }
     
    +    byte[] getData() {
    --- End diff --
    
    Is there a reason that this is package protected rather than private?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-241: Write updated data on reconnect

Posted by alexbrasetvik <gi...@git.apache.org>.
Github user alexbrasetvik commented on the pull request:

    https://github.com/apache/curator/pull/95#issuecomment-127085675
  
    Updated based on feedback. Want me to squash the commits together? :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---