You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/09/14 07:30:20 UTC
[jira] [Commented] (TOMEE-1934) Incorrect double-check locking
[ https://issues.apache.org/jira/browse/TOMEE-1934?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15489679#comment-15489679 ]
ASF GitHub Bot commented on TOMEE-1934:
---------------------------------------
GitHub user SvetlinZarev opened a pull request:
https://github.com/apache/tomee/pull/41
Fix the double-check locking
Due to the java memory model it was
possible to create more than one instance
of the WebappBeanManager. More information
at: http://www.cs.umd.edu/%7Epugh/java/memoryModel/DoubleCheckedLocking.html
Bug: https://issues.apache.org/jira/browse/TOMEE-1934
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/SvetlinZarev/tomee sync_1
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tomee/pull/41.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #41
----
commit 2ceb4bb3715a29c0ff3c532078eebdc940aa7382
Author: Svetlin Zarev <sv...@sap.com>
Date: 2016-09-14T07:24:53Z
Fix the double-check locking
Due to the java memory model it was
possible to create more than one instance
of the WebappBeanManager. More information
at: http://www.cs.umd.edu/%7Epugh/java/memoryModel/DoubleCheckedLocking.html
----
> 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.3.4#6332)