[ https://issues.apache.org/jira/browse/HDFS-9242?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14984482#comment-14984482 ]
Haohui Mai commented on HDFS-9242: ---------------------------------- bq. I think the warning is false positive. We can write a filter rule in the dev-support/findbugsExcludeFile.xml file. Findbug is right. The code is simply broken. It is possible to have multiple instances of cache map. bq. A correct way to fix is to make ugiCache volatile. Could you update it? Fixing it with volatile is a bad idea as it bars many compiler optimization. The suggested pattern is to do it through static initializer blocks, where the synchronization is properly handled. > Fix Findbugs warning from webhdfs.DataNodeUGIProvider.ugiCache > --------------------------------------------------------------- > > Key: HDFS-9242 > URL: https://issues.apache.org/jira/browse/HDFS-9242 > Project: Hadoop HDFS > Issue Type: Bug > Reporter: Xiaoyu Yao > Assignee: Brahma Reddy Battula > Attachments: HDFS-9242.patch > > > This was introduced by HDFS-8855 and pre-patch warning can be found at > https://builds.apache.org/job/PreCommit-HDFS-Build/12975/artifact/patchprocess/trunkFindbugsWarningshadoop-hdfs.html#DC_DOUBLECHECK > {code} > Code Warning > DC Possible doublecheck on > org.apache.hadoop.hdfs.server.datanode.web.webhdfs.DataNodeUGIProvider.ugiCache > in new > org.apache.hadoop.hdfs.server.datanode.web.webhdfs.DataNodeUGIProvider(ParameterParser, > Configuration) > Bug type DC_DOUBLECHECK (click for details) > In class > org.apache.hadoop.hdfs.server.datanode.web.webhdfs.DataNodeUGIProvider > In method new > org.apache.hadoop.hdfs.server.datanode.web.webhdfs.DataNodeUGIProvider(ParameterParser, > Configuration) > On field > org.apache.hadoop.hdfs.server.datanode.web.webhdfs.DataNodeUGIProvider.ugiCache > At DataNodeUGIProvider.java:[lines 49-51] > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)