zookeeper-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] lvfangmin commented on a change in pull request #959: ZOOKEEPER-3402: Add multiRead operation
Date Wed, 05 Jun 2019 21:47:59 GMT
lvfangmin commented on a change in pull request #959: ZOOKEEPER-3402: Add multiRead operation
URL: https://github.com/apache/zookeeper/pull/959#discussion_r290948727
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/MultiTransactionRecord.java
 ##########
 @@ -51,14 +56,32 @@ public MultiTransactionRecord(Iterable<Op> ops) {
         return ops.iterator() ;
     }
 
-    public void add(Op op) {
+    public void add(Op op) throws IllegalArgumentException {
+        setOrCheckOpKind(op.getKind());
         ops.add(op);
     }
 
     public int size() {
         return ops.size();
     }
 
+    /**
+     * Returns the kind of the operations contained by the record.
+     * @return  The OpKind value of all the elements in the record.
+     */
+    public Op.OpKind getOpKind() {
+        return opKind;
+    }
+
+    private void setOrCheckOpKind(Op.OpKind ok) throws IllegalArgumentException {
+        if(opKind == null) {
+            opKind = ok;
+        } else if(ok != opKind) {
 
 Review comment:
   ditto.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message