You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@distributedlog.apache.org by "Sijie Guo (JIRA)" <ji...@apache.org> on 2016/12/13 01:36:58 UTC

[jira] [Updated] (DL-138) Improve the 'synchronized' usage

     [ https://issues.apache.org/jira/browse/DL-138?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sijie Guo updated DL-138:
-------------------------
    Description: 
{quote}
191 Methods are synchronized using the ‘synchronized’ modifier in the declaration. It is not a good programming practise to use this modifier at method level. Normally, it is more recommendable to implement synchronized code blocks inside methods. The reason is very simple. If other people modify these methods later, it will not be easy for them to realise that the entire method is synchronized. They will surely expand the method with code that is not necessary to synchronize. In the long term, the application will become more and more linear in execution, taking way less advantage of the hardware resources, and will be slower.
{quote}

https://www.kiuwan.com/blog/analyzing_distributedlog_twitter-2/

  was:
{quote}
191 Methods are synchronized using the ‘synchronized’ modifier in the declaration. It is not a good programming practise to use this modifier at method level. Normally, it is more recommendable to implement synchronized code blocks inside methods. The reason is very simple. If other people modify these methods later, it will not be easy for them to realise that the entire method is synchronized. They will surely expand the method with code that is not necessary to synchronize. In the long term, the application will become more and more linear in execution, taking way less advantage of the hardware resources, and will be slower.
{quote}


> Improve the 'synchronized' usage 
> ---------------------------------
>
>                 Key: DL-138
>                 URL: https://issues.apache.org/jira/browse/DL-138
>             Project: DistributedLog
>          Issue Type: Task
>            Reporter: Sijie Guo
>
> {quote}
> 191 Methods are synchronized using the ‘synchronized’ modifier in the declaration. It is not a good programming practise to use this modifier at method level. Normally, it is more recommendable to implement synchronized code blocks inside methods. The reason is very simple. If other people modify these methods later, it will not be easy for them to realise that the entire method is synchronized. They will surely expand the method with code that is not necessary to synchronize. In the long term, the application will become more and more linear in execution, taking way less advantage of the hardware resources, and will be slower.
> {quote}
> https://www.kiuwan.com/blog/analyzing_distributedlog_twitter-2/



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