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

Laszlo Bodor commented on HIVE-20043:
-------------------------------------

i think AtomicBoolean is enough, checked patch history of HIVE-19813, first 
synchronized was moved from method signature to isStarted checker block, and 
then AtomicBoolean was added, however the latter seems to be enough in this case
attached test case

> HiveServer2: SessionState has a static sync block around an AtomicBoolean
> -------------------------------------------------------------------------
>
>                 Key: HIVE-20043
>                 URL: https://issues.apache.org/jira/browse/HIVE-20043
>             Project: Hive
>          Issue Type: Bug
>          Components: HiveServer2
>    Affects Versions: 3.0.0
>            Reporter: Gopal V
>            Assignee: Laszlo Bodor
>            Priority: Major
>              Labels: Concurrency
>         Attachments: HIVE-20043.01.patch
>
>
> {code}
>   private static void start(SessionState startSs, boolean isAsync, LogHelper 
> console) {
> ...
>     synchronized(SessionState.class) {
>       if (!startSs.isStarted.compareAndSet(false, true)) {
>         return;
>       }
>     }
> {code}
> startSs.isStarted is an AtomicBoolean, which makes it hard to know why this 
> code is locked with a static lock.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to