Hiroshi Ikeda commented on HBASE-16648:

My bad, I didn't realized that the default implementation is overridden by the 
interface. Although CopyOnWriteArrayMap.putIfAbsent is wrongly implemented, it 
seems computeIfAbsent works well.

bq. Lock does not reduce performance, the problem is contention.

Generally speaking, lock can reduce performance by context switches when 
contention occurs, while CAS doesn't block. Moreover the implementation is not 
so trivial and causes overhead to ensure atomicity in ConcurretHashMap.

> [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

Reply via email to