[ https://issues.apache.org/jira/browse/TOMEE-1934?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16047725#comment-16047725 ]
Svetlin Zarev commented on TOMEE-1934: -------------------------------------- It was discovered by a Fortify scan, but it can be false positive (if it's running in a single thread) > Incorrect double-check locking > ------------------------------ > > Key: TOMEE-1934 > URL: https://issues.apache.org/jira/browse/TOMEE-1934 > Project: TomEE > Issue Type: Bug > Reporter: Svetlin Zarev > Priority: Trivial > > http://www.cs.umd.edu/%7Epugh/java/memoryModel/DoubleCheckedLocking.html > {code} > public BeanManagerImpl getBeanManagerImpl() { > if (bm == null) { // should be done in the constructor > synchronized (this) { > if (bm == null) { > bm = new WebappBeanManager(this); > } > } > } > return bm; > } > {code} > Unless **bm** is volatile, multiple instances of the bean manager can be > created under concurrent conditions. > PS: I saw the suppress warning. I'm not sure if PMD just warns against DCL or > that it was broken. -- This message was sent by Atlassian JIRA (v6.4.14#64029)