You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Hadoop QA (JIRA)" <ji...@apache.org> on 2010/12/07 12:13:11 UTC

[jira] Commented: (ZOOKEEPER-955) Use Atomic(Integer|Long) for (Z)Xid

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12968684#action_12968684 ] 

Hadoop QA commented on ZOOKEEPER-955:
-------------------------------------

-1 overall.  Here are the results of testing the latest attachment 
  http://issues.apache.org/jira/secure/attachment/12465683/ZOOKEEPER-955.patch
  against trunk revision 1040752.

    +1 @author.  The patch does not contain any @author tags.

    -1 tests included.  The patch doesn't appear to include any new or modified tests.
                        Please justify why no new tests are needed for this patch.
                        Also please list what manual steps were performed to verify this patch.

    +1 javadoc.  The javadoc tool did not generate any warning messages.

    +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

    -1 findbugs.  The patch appears to introduce 8 new Findbugs (version 1.3.9) warnings.

    +1 release audit.  The applied patch does not increase the total number of release audit warnings.

    +1 core tests.  The patch passed core unit tests.

    +1 contrib tests.  The patch passed contrib unit tests.

Test results: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/63//testReport/
Findbugs warnings: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/63//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: https://hudson.apache.org/hudson/job/PreCommit-ZOOKEEPER-Build/63//console

This message is automatically generated.

> Use Atomic(Integer|Long) for (Z)Xid
> -----------------------------------
>
>                 Key: ZOOKEEPER-955
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-955
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: java client, server
>            Reporter: Thomas Koch
>            Assignee: Thomas Koch
>            Priority: Trivial
>         Attachments: ZOOKEEPER-955.patch
>
>
> As I've read last weekend in the fantastic book "Clean Code", it'd be much faster to use AtomicInteger or AtomicLong instead of synchronization blocks around each access to an int or long.
> The key difference is, that a synchronization block will in any case acquire and release a lock. The atomic classes use "optimistic locking", a CPU operation that only changes a value if it still has not changed since the last read.
> In most cases the value has not changed since the last visit so the operation is just as fast as a normal operation. If it had changed, then we read again and try to change again.
> [1] Clean Code: A Handbook of Agile Software Craftsmanship (Robert C. Martin) 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.