[ https://issues.apache.org/jira/browse/HADOOP-9504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13643460#comment-13643460 ]
Jason Lowe commented on HADOOP-9504: ------------------------------------ ConcurrentHashMap doesn't prevent the kind of corruption I was referring to. Take the following scenario: Threads A and B both want to publish to the map. A wants to publish X:1 and Y:2 while B wants to publish X:3 and Y:4. If we create the map in the constructor and never replace it, then threads racing can end up with a map that is X:3, Y:1 which matches neither thread's view and thus is inconsistent relative to the two views the threads wanted to publish. Creating separate maps in each thread and publishing them as an entire map at once would prevent that. That being said, it looks like the racing threads in createMBeanInfo are trying to publish the *same* values to the map, so the type of corruption I was worried about should not occur. My apologies for not noticing that earlier. > MetricsDynamicMBeanBase has concurrency issues in createMBeanInfo > ----------------------------------------------------------------- > > Key: HADOOP-9504 > URL: https://issues.apache.org/jira/browse/HADOOP-9504 > Project: Hadoop Common > Issue Type: Bug > Components: metrics > Affects Versions: 3.0.0, 2.0.3-alpha > Reporter: Liang Xie > Assignee: Liang Xie > Priority: Critical > Attachments: HADOOP-9504.txt, HADOOP-9504-v2.txt > > > Please see HBASE-8416 for detail information. > we need to take care of the synchronization for HashMap put(), otherwise it > may lead to spin loop. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira