[
https://issues.apache.org/jira/browse/HADOOP-10169?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13853023#comment-13853023
]
Jason Lowe commented on HADOOP-10169:
-------------------------------------
Thanks for updating the patch. One last nit is that this code:
{code}
if (gcInfo == null) {
gcInfo = new MetricsInfo[2];
....
MetricsInfo[] previousGcInfo = gcInfoCache.putIfAbsent(gcName, gcInfo);
if (previousGcInfo == null) {
return gcInfo;
}
return previousGcInfo;
}
return gcInfo;
{code}
can be simplified to the following so there aren't so many return statements to
track:
{code}
if (gcInfo == null) {
gcInfo = new MetricsInfo[2];
....
MetricsInfo[] previousGcInfo = gcInfoCache.putIfAbsent(gcName, gcInfo);
if (previousGcInfo != null) {
gcInfo = previousGcInfo;
}
}
return gcInfo;
{code}
> remove the unnecessary synchronized in JvmMetrics class
> --------------------------------------------------------
>
> Key: HADOOP-10169
> URL: https://issues.apache.org/jira/browse/HADOOP-10169
> Project: Hadoop Common
> Issue Type: Improvement
> Components: metrics
> Affects Versions: 3.0.0, 2.2.0
> Reporter: Liang Xie
> Assignee: Liang Xie
> Priority: Minor
> Attachments: HADOOP-10169-v2.txt, HADOOP-10169-v3.txt,
> HADOOP-10169.txt
>
>
> When i looked into a HBase JvmMetric impl, just found this synchronized seems
> not essential.
--
This message was sent by Atlassian JIRA
(v6.1.4#6159)