[ 
https://issues.apache.org/jira/browse/HBASE-16648?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15506758#comment-15506758
 ] 

Duo Zhang commented on HBASE-16648:
-----------------------------------

I'm not Doug Lee so it is hard to tell what exactly happens here. But the logic 
of computeIfAbsent is more complicated than putIfAbsent if the bin is empty. 
For putIfAbsent it is just a CAS. For computeIfAbsent, we need to create a 
RservationNode first, synchronized on it, do CAS, and finally we need to 
replace the node with an volatile put.

> [JDK8] Use computeIfAbsent instead of get and putIfAbsent
> ---------------------------------------------------------
>
>                 Key: HBASE-16648
>                 URL: https://issues.apache.org/jira/browse/HBASE-16648
>             Project: HBase
>          Issue Type: Sub-task
>          Components: Performance
>    Affects Versions: 2.0.0
>            Reporter: Duo Zhang
>            Assignee: Duo Zhang
>             Fix For: 2.0.0
>
>         Attachments: HBASE-16648-v1.patch, HBASE-16648-v2.patch, 
> HBASE-16648.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to