[
https://issues.jboss.org/browse/JBTM-2949?page=com.atlassian.jira.plugin....
]
Michael Musgrove commented on JBTM-2949:
----------------------------------------
I have taken a look back at older version of the code and we have already had four goes at
implementing this (although we haven't tried Luis's approach):
Fix 1: removeChildThread(Thread.currentThread().getName());
Fix 2 (JBOSSTS_4_2_2_GA): final String threadId =
Integer.toHexString(System.identityHashCode(t)) ;
Fix 3 (JBOSSTS_4_2_3_GA):_childThreads.put(ThreadUtil.getThreadId(t), t);
Fix 4: the one that Tom did in the 5 stream.
Clearly there is a history of getting this wrong and I would prefer not to try a new
implementation without being able to quantify the benefit (I am not say there is no
benefit but we need to see the numbers).
Remove synchronization from ThreadUtil.getThreadId
--------------------------------------------------
Key: JBTM-2949
URL:
https://issues.jboss.org/browse/JBTM-2949
Project: JBoss Transaction Manager
Issue Type: Enhancement
Reporter: Luis Barreiro
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:
# *ConcurrentWeakHashMap* - replace the current {{WeakHashMap}} for a similar data
structure that can handle concurrent access. This keeps the same behavior.
# *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.
# *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.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)