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

David Mollitor commented on HIVE-23124:
---------------------------------------

[~pvary] I put up a new patch to remove {{Callable}}.  Thanks.

We cannot use {{computeIfAbsent}} here, instead just using {{compute}}.  
{{computeIfAbsent}} is good in situations where multiple threads are building 
up a Map for display or further processing, however, since in this scenario, 
there are threads adding and removing from the {{Map}}, the {{Map}} needs to be 
locked down more tightly, otherwise, there are subtle race conditions, because 
one thread is computing an (absent) value, and then modifying that value, while 
another thread may sweep in between the compute and the increment and remove 
the value first, in which case, the first thread is increment a dead value.

> Review of SQLOperation Class
> ----------------------------
>
>                 Key: HIVE-23124
>                 URL: https://issues.apache.org/jira/browse/HIVE-23124
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: David Mollitor
>            Assignee: David Mollitor
>            Priority: Major
>         Attachments: HIVE-23124.1.patch, HIVE-23124.2.patch
>
>
> * Use ConcurrentHashMap instead of synchronized methods to improve 
> multi-threaded access
>  * Use JDK 8 facilities where applicable
>  * General cleanup
>  * Better log messages and Exception messages
>  * Use {{switch}} statement instead of if/else blocks
>  * Checkstyle fixes



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to