2.22.2.5. ZooKeeper Multiple Operations Interface
public class ZooKeeper {
...
// Execute multiple operations atomically.
public List<OpResult> multi (Iterable<Op> ops) { ... }
public void multi (Iterable<Op> ops, MultiCallback cb, Object ctx) { ... }
...
}
public abstract class Op {
private int type;
private String path;
private Op (int type, String path) {
this.type = type;
this.path = path;
}
public static Op create (String path, byte [] data, List<ACL> acl, int flags) {
return new Create (path, data, acl, flags);
}
public static class Create extends Op {
private byte [] data;
private List<ACL> acl;
private int flags;
private Create (String path, byte [] data, List<ACL> acl, int flags) {
super (ZooDefs.OpCode.create, path);
this.data = data;
this.acl = acl;
this.flags = flags;
}
...
}
...
}
public abstract class OpResult {
private int type;
private OpResult (int type) {
this.type = type;
}
public static class CreateResult extends OpResult {
private String path;
public CreateResult (String path) {
super (ZooDefs.OpCode.create);
this.path = path;
}
...
}
...
}