[jboss-jira] [JBoss JIRA] Resolved: (JBTM-182) Missing synchronization?

Jonathan Halliday (JIRA) jira-events at jboss.com
Tue Jan 2 06:14:26 EST 2007


     [ http://jira.jboss.com/jira/browse/JBTM-182?page=all ]

Jonathan Halliday resolved JBTM-182.
------------------------------------

    Resolution: Done

Quite right. I changed the created datatype without paying enough attention to the overall structure of the method. Fixed in svn revision 8603, 2007-01-02.

> Missing synchronization?
> ------------------------
>
>                 Key: JBTM-182
>                 URL: http://jira.jboss.com/jira/browse/JBTM-182
>             Project: JBoss Transaction Manager
>          Issue Type: Task
>      Security Level: Public(Everyone can see) 
>          Components: JTA Implementation
>    Affects Versions: 4.2.3
>            Reporter: Mark Little
>         Assigned To: Jonathan Halliday
>             Fix For: 4.2.3
>
>
> In addSynchronization for TwoPhaseCoordinator, the synchronization object is created if it isn't already set:
> if (_synchs == null)
> {
> 	// Synchronizations should be stored (or at least iterated) in their natural order
> 	_synchs = new TreeSet();
> }
> if (_synchs.add(sr))
> {
> 	result = AddOutcome.AR_ADDED;
> }
> However, because multiple threads could be calling the same transaction instance concurrently, shouldn't there be a synchronization around this block? It's possible that two threads could test and try to set the _synchs and because of interleaving one thread creates _synchs after the other thread already has and added it's resource (which would then become garbage).

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

        



More information about the jboss-jira mailing list