Example usage for org.apache.zookeeper Op validate

List of usage examples for org.apache.zookeeper Op validate

Introduction

In this page you can find the example usage for org.apache.zookeeper Op validate.

Prototype

void validate() throws KeeperException 

Source Link

Document

Performs client path validations.

Usage

From source file:org.lab.mars.onem2m.ZooKeeper.java

License:Apache License

/**
 * Executes multiple ZooKeeper operations or none of them.
 * <p>//from ww  w.  j  ava2 s  . c om
 * On success, a list of results is returned. On failure, an exception is
 * raised which contains partial results and error details, see
 * {@link KeeperException#getResults}
 * <p>
 * Note: The maximum allowable size of all of the data arrays in all of the
 * setData operations in this single request is typically 1 MB (1,048,576
 * bytes). This limit is specified on the server via <a href=
 * "http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#Unsafe+Options"
 * >jute.maxbuffer</a>. Requests larger than this will cause a
 * KeeperException to be thrown.
 *
 * @param ops
 *            An iterable that contains the operations to be done. These
 *            should be created using the factory methods on {@link Op}.
 * @return A list of results, one for each input Op, the order of which
 *         exactly matches the order of the <code>ops</code> input
 *         operations.
 * @throws InterruptedException
 *             If the operation was interrupted. The operation may or may
 *             not have succeeded, but will not have partially succeeded if
 *             this exception is thrown.
 * @throws KeeperException
 *             If the operation could not be completed due to some error in
 *             doing one of the specified ops.
 * @throws IllegalArgumentException
 *             if an invalid path is specified
 *
 * @since 3.4.0
 */
public List<OpResult> multi(Iterable<Op> ops) throws InterruptedException, KeeperException {
    for (Op op : ops) {
        op.validate();
    }
    // reconstructing transaction with the chroot prefix
    List<Op> transaction = new ArrayList<Op>();
    for (Op op : ops) {
        transaction.add(withRootPrefix(op));
    }
    return multiInternal(new MultiTransactionRecord(transaction));
}