kylin-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KYLIN-3578) Do not synchronize on the intrinsic locks of high-level concurrency objects
Date Wed, 26 Sep 2018 06:27:00 GMT

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

ASF GitHub Bot commented on KYLIN-3578:
---------------------------------------

hit-lacus commented on issue #253: KYLIN-3578 Condition replaces the use of the Object monitor
methods
URL: https://github.com/apache/kylin/pull/253#issuecomment-424599627
 
 
   ```java
   if (delta < 0) {
        synchronized (lock) {
           lock.notifyAll();
       }
   }
   ```
   This code above seems violates good practice, but it's just a trick.So it is no need to
repair it.
   
   [oracle locksync doc](https://docs.oracle.com/javase/tutorial/essential/concurrency/locksync.html)
   [Chinese Javadoc](https://github.com/hit-lacus/kylin/blob/86108c41552dea1f248abb71ddbeac8f82900005/core-common/src/main/java/org/apache/kylin/common/util/MemoryBudgetController.java)
   [Do not synchronize on the intrinsic locks of high-level concurrency objects](https://wiki.sei.cmu.edu/confluence/display/java/LCK03-J.+Do+not+synchronize+on+the+intrinsic+locks+of+high-level+concurrency+objects)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Do not synchronize on the intrinsic locks of high-level concurrency objects
> ---------------------------------------------------------------------------
>
>                 Key: KYLIN-3578
>                 URL: https://issues.apache.org/jira/browse/KYLIN-3578
>             Project: Kylin
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: XiaoXiang Yu
>            Priority: Major
>             Fix For: v2.6.0
>
>
> From core-common/src/main/java/org/apache/kylin/common/util/MemoryBudgetController.java
:
> {code}
>     private final ReentrantLock lock = new ReentrantLock();
> ...
>             synchronized (lock) {
> {code}
> See the following for why such practice is to be avoided:
> https://wiki.sei.cmu.edu/confluence/display/java/LCK03-J.+Do+not+synchronize+on+the+intrinsic+locks+of+high-level+concurrency+objects



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

Mime
View raw message