Marcosrico commented on code in PR #2328:
URL: https://github.com/apache/helix/pull/2328#discussion_r1056619386


##########
zookeeper-api/src/main/java/org/apache/helix/zookeeper/impl/client/FederatedZkClient.java:
##########
@@ -477,10 +477,31 @@ public long getCreationTime(String path) {
     return getZkClient(path).getCreationTime(path);
   }
 
+  /**
+   * Executes ZkMulti on operations that are connected to the same Zk server.
+   * Will throw exception if any operation's server connection is different.
+   * @param ops
+   * @return
+   * @throws IllegalArgumentException
+   */
   @Override
   public List<OpResult> multi(Iterable<Op> ops) {
-    throwUnsupportedOperationException();
-    return null;
+    if (ops == null) {
+      throw new NullPointerException("ops must not be null.");
+    }
+    String opPath = null;
+    String opPathRealm = null;
+    for (Op op : ops) {
+      if (opPath == null) {
+        opPath = op.getPath();
+        opPathRealm = getZkRealm(op.getPath());
+      } else {
+        if (!opPathRealm.equals(getZkRealm(op.getPath()))){
+          throw new IllegalArgumentException("Cannot execute multi on ops of 
different realms!");
+        }
+      }
+    }
+    return getZkClient(opPath).multi(ops);

Review Comment:
   getZkRealm() method checks whether the input path is a valid opPath so it 
would fail before entering this call. Perhaps we should write a catch / throw 
clause in the case that occurs?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to