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

ASF GitHub Bot commented on CURATOR-140:
----------------------------------------

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

    https://github.com/apache/curator/pull/48#discussion_r19764502
  
    --- Diff: 
curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessReadWriteLock.java
 ---
    @@ -261,6 +261,39 @@ public Void call() throws Exception
             Assert.assertTrue(maxConcurrentCount.get() > 1);
         }
     
    +    @Test
    +    public void     testSetNodeData() throws Exception
    +    {
    +        CuratorFramework        client = 
CuratorFrameworkFactory.newClient(server.getConnectString(), new 
RetryOneTime(1));
    +
    +        try
    +        {
    +            client.start();
    +
    +            final byte[] nodeData = new byte[] { 1, 2, 3, 4 };
    +
    +            InterProcessReadWriteLock   lock = new 
InterProcessReadWriteLock(client, "/lock", nodeData);
    +
    +            // mutate passed-in node data, lock has made copy
    +            nodeData[0] = 5;
    --- End diff --
    
    Ok, just wasn't obvious because there's no explicit assert checking that 
the data in the InterProcessReadWriteLock is different to the mutated nodeData 
array. I notice that there's no way of getting this data out of the 
InterProcessReadWriteLock to do an explicit assert though, so I think that this 
is fine.


> Support the initial data for the node in InterProcessReadWriteLock
> ------------------------------------------------------------------
>
>                 Key: CURATOR-140
>                 URL: https://issues.apache.org/jira/browse/CURATOR-140
>             Project: Apache Curator
>          Issue Type: Improvement
>          Components: Recipes
>            Reporter: Azrael
>            Priority: Minor
>
> Currently, locks(writeLock, readLock) in InterProcessReadWriteLock use the 
> InetAddress for a initial data for the node, It is a little difficult to 
> debug the lock owner as it shows only IP. If the initial data for lock node 
> can be set, participantNodes contains the given information(hostname, id). 
> So, it is easy  to debug participantNodes.
> {code}
> writeLock = InterProcessReadWriteLock.writeLock();
> Collection<String> nodes = writeLock.getParticipantNodes();
> for (String node: nodes) {
>     String nodeData = new String(client.getData().forPath(node));
> }
> {code} 
> {{nodeData}} should be the information which is given in argument.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to