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-4.2.3.GA, JBossAS-5.0.0.CR1
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