Uploaded image for project: 'JBoss Transaction Manager'
  1. JBoss Transaction Manager
  2. JBTM-182

Missing synchronization?

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major Major
    • 4.2.3
    • 4.2.3
    • JTA
    • None

      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).

              rhn-engineering-jhallida Jonathan Halliday
              nmcl2001 Mark Little
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: