[jboss-jira] [JBoss JIRA] Closed: (JBAS-5904) ClientUserTransaction singleton initialisation is not thread safe

Adrian Brock (JIRA) jira-events at lists.jboss.org
Fri Aug 29 09:47:39 EDT 2008


     [ https://jira.jboss.org/jira/browse/JBAS-5904?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adrian Brock closed JBAS-5904.
------------------------------

    Resolution: Done


> ClientUserTransaction singleton initialisation is not thread safe
> -----------------------------------------------------------------
>
>                 Key: JBAS-5904
>                 URL: https://jira.jboss.org/jira/browse/JBAS-5904
>             Project: JBoss Application Server
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Transaction Manager (JBossTM)
>    Affects Versions: JBossAS-5.0.0.CR1, JBossAS-4.2.3.GA
>            Reporter: Adrian Brock
>            Assignee: Adrian Brock
>             Fix For: JBossAS-5.0.0.CR2, JBossAS-4.2.4.GA
>
>
> The ClientUserTransaction singleton initialistation is not thread safe:
> private static ClientUserTransaction singleton = null;
> public static ClientUserTransaction getSingleton()
> {
>    if (singleton == null)
>       singleton = new ClientUserTransaction();
>    return singleton;
> }
> Two threads can race to create the singleton which means the ThreadLocal within the class can become
> "masked".
> The construction of the singleton needs moving to static initialisation.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list