You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by ma...@apache.org on 2012/02/06 09:56:12 UTC
svn commit: r1240931 - in /zookeeper/trunk: CHANGES.txt
src/java/main/org/apache/zookeeper/KeeperException.java
src/java/main/org/apache/zookeeper/Transaction.java
src/java/main/org/apache/zookeeper/ZooKeeper.java
Author: mahadev
Date: Mon Feb 6 08:56:11 2012
New Revision: 1240931
URL: http://svn.apache.org/viewvc?rev=1240931&view=rev
Log:
ZOOKEEPER-1336. javadoc for multi is confusing, references functionality that doesn't seem to exist. (phunt via mahadev)
Modified:
zookeeper/trunk/CHANGES.txt
zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java
zookeeper/trunk/src/java/main/org/apache/zookeeper/Transaction.java
zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java
Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1240931&r1=1240930&r2=1240931&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Mon Feb 6 08:56:11 2012
@@ -116,6 +116,9 @@ BUGFIXES:
ZOOKEEPER-1352. server.InvalidSnapshotTest is using connection timeouts
that are too short. (phunt via mahadev)
+
+ ZOOKEEPER-1336. javadoc for multi is confusing, references functionality that doesn't seem
+ to exist. (phunt via mahadev)
IMPROVEMENTS:
Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java?rev=1240931&r1=1240930&r2=1240931&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java (original)
+++ zookeeper/trunk/src/java/main/org/apache/zookeeper/KeeperException.java Mon Feb 6 08:56:11 2012
@@ -482,6 +482,9 @@ public abstract class KeeperException ex
* If this exception was thrown by a multi-request then the (partial) results
* and error codes can be retrieved using this getter.
* @return A copy of the list of results from the operations in the multi-request.
+ *
+ * @since 3.4.0
+ *
*/
public List<OpResult> getResults() {
return results != null ? new ArrayList<OpResult>(results) : null;
Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/Transaction.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/Transaction.java?rev=1240931&r1=1240930&r2=1240931&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/zookeeper/Transaction.java (original)
+++ zookeeper/trunk/src/java/main/org/apache/zookeeper/Transaction.java Mon Feb 6 08:56:11 2012
@@ -24,6 +24,9 @@ import java.util.List;
/**
* Provides a builder style interface for doing multiple updates. This is
* really just a thin layer on top of Zookeeper.multi().
+ *
+ * @since 3.4.0
+ *
*/
public class Transaction {
private ZooKeeper zk;
Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java?rev=1240931&r1=1240930&r2=1240931&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java (original)
+++ zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java Mon Feb 6 08:56:11 2012
@@ -871,22 +871,31 @@ public class ZooKeeper {
}
/**
- * Executes multiple Zookeeper operations or none of them. On success, a list of results is returned.
- * On failure, only a single exception is returned. If you want more details, it may be preferable to
- * use the alternative form of this method that lets you pass a list into which individual results are
- * placed so that you can zero in on exactly which operation failed and why.
- * <p>
- * The maximum allowable size of all of the data arrays in all of the setData operations in this single
- * request is 1 MB (1,048,576 bytes).
- * Requests larger than this will cause a KeeperExecption to be thrown.
- * @param ops An iterable that contains the operations to be done. These should be created using the
- * factory methods on Op.
- * @see Op
- * @return A list of results.
- * @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.
+ * Executes multiple ZooKeeper operations or none of them.
+ * <p>
+ * 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.
+ *
+ * @since 3.4.0
*/
public List<OpResult> multi(Iterable<Op> ops) throws InterruptedException, KeeperException {
return multiInternal(new MultiTransactionRecord(ops));
@@ -921,6 +930,15 @@ public class ZooKeeper {
return results;
}
+ /**
+ * A Transaction is a thin wrapper on the {@link #multi} method
+ * which provides a builder object that can be used to construct
+ * and commit an atomic set of operations.
+ *
+ * @since 3.4.0
+ *
+ * @return a Transaction builder object
+ */
public Transaction transaction() {
return new Transaction(this);
}