[jboss-jira] [JBoss JIRA] Commented: (JBAS-5904) ClientUserTransaction singleton initialisation is not thread safe
Galder Zamarreno (JIRA)
jira-events at lists.jboss.org
Mon Sep 1 05:50:38 EDT 2008
[ https://jira.jboss.org/jira/browse/JBAS-5904?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12427544#action_12427544 ]
Galder Zamarreno commented on JBAS-5904:
----------------------------------------
This issue affects transaction sticky functionality quite badly
because the key of weak hashmap that maps transactions to
sticky nodes is a thread local within ClientUserTransaction. So,
this bug lead to multiple ClientUserTransaction instances to be
created and garbage collection previous ones, effectively
removing transaction (tpc to be more precise) to sticky target
mappings of on going transactions.
> 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