[
https://issues.apache.org/jira/browse/ZOOKEEPER-1336?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13181221#comment-13181221
]
Rakesh R commented on ZOOKEEPER-1336:
-------------------------------------
I feel, it would be good provides sample usage of multi and transaction in
javadocs. Below are few suggestions:
+multi usage as method-level javadoc:+
{noformat}
* <P>
* In the following example of multi-update, <code>zkper</code> represents
* an active ZK client connection:
* <PRE>
* Op createEphe1 = Op.create("/sample", new String ( "sample" ).getBytes (),
* org.apache.zookeeper.ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode
* .fromFlag ( 2 ) );
* Op createEphe2 = Op.create("/sample", new String ( "sample" ).getBytes (),
* org.apache.zookeeper.ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode
* .fromFlag ( 2 ) );
* List<Op> ops = new ArrayList<Op>();
* ops.add(createEphe1);
* ops.add(createEphe2);
* zkper.multi(ops);
* </PRE>
{noformat}
+Transaction usage as class-level javadoc:+
{noformat}
* <P>
* In the following example of transaction, <code>zkper</code> represents
* an active ZK client connection:
* <PRE>
* Transaction transaction = zkper.transaction();
* transaction.create("/sample", new String ( "sample" ).getBytes (),
* org.apache.zookeeper.ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode
* .fromFlag ( 2 ) );
* transaction.create("/sample", new String ( "sample" ).getBytes (),
* org.apache.zookeeper.ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode
* .fromFlag ( 2 ) );
* transaction.commit();
* </PRE>
{noformat}
Thanks,
Rakesh
> javadoc for multi is confusing, references functionality that doesn't seem to
> exist
> ------------------------------------------------------------------------------------
>
> Key: ZOOKEEPER-1336
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1336
> Project: ZooKeeper
> Issue Type: Bug
> Components: java client
> Affects Versions: 3.4.1
> Reporter: Patrick Hunt
> Assignee: Patrick Hunt
> Fix For: 3.4.3, 3.5.0
>
> Attachments: ZOOKEEPER-1336.patch
>
>
> There's this in org.apache.zookeeper.ZooKeeper.multi(Iterable<Op>)
> {noformat}
> * 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.
> {noformat}
> What is the "alternate form of this method" that's being referred to? Seems
> like we should add this functionality, or at the very least update the
> javadoc. (I don't think this is referring to Transaction, although the docs
> there are pretty thin)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira