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

Remove synchronization from ThreadUtil.getThreadId

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • Major
    • None
    • None
    • None
    • None

    Description

      JBTM-2808 adds synchronization on ThreadUtil.getThreadId() but that solution does not scale well enough under high contention.

      There seems to be ways to remove this synchronization:

      1. ConcurrentWeakHashMap - replace the current WeakHashMap for a similar data structure that can handle concurrent access. This keeps the same behavior.
      2. Use Thread.getId() - remove all mappings and generate the threadId from the Thread. Although the javadoc mentions that IDs can be reused, the implementation is a counter, like what ThreadUtil has now. This is the simplest and most elegant fix.
      3. Remove threadId - remove the generation of threadId and use the Thread throughout the code, generating string IDs when necessary. Probably yields the best performance, but requires the most changes.

      Attachments

        Activity

          People

            Unassigned Unassigned
            lbarreiro-1 Luis Barreiro
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: