Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
Description
Every time a p2p thread owned connection is created it is added to a HashMap kept by the thread in a ThreadLocal. A WeakReference referencing that HashMap is also added to an ArrayList. But this ArrayList is not actually used for anything. It is iterated over in ConnectionTable.close to close any of the thread local connections but all of these connections are also in the "threadConnectionMap" which is iterated over during close.
So the ArrayList "threadConnMaps" can be removed with no loss of functionality. Getting rid of it will improve performance the first time a thread creates a thread owned connection and will reduce the amount of memory consumed (the ArrayList will have at least one entry for every thread using thread owned connections but it may have more since the WeakReference can be slow to be garbage collected).