DESCRIPTION

tmf: Use ConcurrentHashMap in TmfStatisticsTreeNode

Since multiple threads can update the statistics when using
experiments with more than one trace the tree node structure needs
to thread-safe. Using a ConcurrentHashMap instead of a regular HashMap
avoids ConcurrentModificationException for the current way this class
is used in TMF.

Change-Id: I38127466066660f82fb9cddd1465cb5e62c114c6
Signed-off-by: Ricky Reeves <Meredith xxx@xxx.xxx


COMMENTS

author: Ricky Reeves
date: 2014-03-25 13:05:08.000000000

Uploaded patch set 3.

-------------------------------------
author: Brenden Conley
date: 2014-03-25 13:05:14.000000000

Patch Set 3:

Build Started https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/6087/

-------------------------------------
author: Ricky Reeves
date: 2014-03-25 13:13:43.000000000

Patch Set 3:

Looking closer at the differences between ConcurrentHashMap() and Collections.synchronizedMap(), I realized that the latter is not working for us because iterations over the map using iterators needs to be synchronized on the map. Otherwise we'll get ConcurrentModificationException. Since in the code we do that at several places, we would have to change these iterations to make it thread-safe. Using ConcurrentHashMap we don't have that constraint. The implementation will not cause ConcurrentModificationExceptions during an iteration. So, I changed the patch back to use ConcurrentHashMap(). I removed the failing test cases for null values since null values should not be used. The handling of null values could be improved in another patch.

-------------------------------------
author: Brenden Conley
date: 2014-03-25 13:53:37.000000000

Patch Set 3: Verified+1

Build Successful 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/6087/ : SUCCESS

-------------------------------------
author: Braxton Mccarthy
date: 2014-03-26 17:04:36.000000000

Patch Set 3: Code-Review+2 IP-Clean+1

Yeah, using synchronizedMap requires to do synchronize(map) when doing iterations. That can get complicated when the map (or Iterable view) is exposed through the API.

-------------------------------------
