Parcourir la source

ZOOKEEPER-2818: Improve the ZooKeeper#setACL java doc

Author: b00902108 <brahmareddy.battula@huawei.com>

Reviewers: Michael Han <hanm@apache.org>

Closes #291 from brahmareddybattula/ZOOKEEPER-2818
b00902108 il y a 8 ans
Parent
commit
7db83eb9dc

+ 2 - 2
src/contrib/zooinspector/src/java/org/apache/zookeeper/retry/ZooKeeperRetry.java

@@ -217,12 +217,12 @@ public class ZooKeeperRetry extends ZooKeeper {
     }
 
     @Override
-    public Stat setACL(String path, List<ACL> acl, int version)
+    public Stat setACL(String path, List<ACL> acl, int aclVersion)
             throws KeeperException, InterruptedException {
         int count = 0;
         do {
             try {
-                return super.setACL(path, acl, version);
+                return super.setACL(path, acl, aclVersion);
             } catch (KeeperException.ConnectionLossException e) {
                 LoggerFactory.getLogger().warn(
                         "ZooKeeper connection lost.  Trying to reconnect.");

+ 7 - 7
src/java/main/org/apache/zookeeper/ZooKeeper.java

@@ -2347,25 +2347,25 @@ public class ZooKeeper implements AutoCloseable {
 
     /**
      * Set the ACL for the node of the given path if such a node exists and the
-     * given version matches the version of the node. Return the stat of the
+     * given aclVersion matches the acl version of the node. Return the stat of the
      * node.
      * <p>
      * A KeeperException with error code KeeperException.NoNode will be thrown
      * if no node with the given path exists.
      * <p>
      * A KeeperException with error code KeeperException.BadVersion will be
-     * thrown if the given version does not match the node's version.
+     * thrown if the given aclVersion does not match the node's aclVersion.
      *
-     * @param path
-     * @param acl
-     * @param version
+     * @param path the given path for the node
+     * @param acl the given acl for the node
+     * @param aclVersion the given acl version of the node
      * @return the stat of the node.
      * @throws InterruptedException If the server transaction is interrupted.
      * @throws KeeperException If the server signals an error with a non-zero error code.
      * @throws org.apache.zookeeper.KeeperException.InvalidACLException If the acl is invalide.
      * @throws IllegalArgumentException if an invalid path is specified
      */
-    public Stat setACL(final String path, List<ACL> acl, int version)
+    public Stat setACL(final String path, List<ACL> acl, int aclVersion)
         throws KeeperException, InterruptedException
     {
         final String clientPath = path;
@@ -2381,7 +2381,7 @@ public class ZooKeeper implements AutoCloseable {
             throw new KeeperException.InvalidACLException(clientPath);
         }
         request.setAcl(acl);
-        request.setVersion(version);
+        request.setVersion(aclVersion);
         SetACLResponse response = new SetACLResponse();
         ReplyHeader r = cnxn.submitRequest(h, request, response, null);
         if (r.getErr() != 0) {