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-21 13:42:41.000000000

Uploaded patch set 1.

-------------------------------------
author: Brenden Conley
date: 2014-03-21 13:42:46.000000000

Patch Set 1:

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

-------------------------------------
author: Brenden Conley
date: 2014-03-21 14:02:22.000000000

Patch Set 1: Verified-1

Build Failed 

https://hudson.eclipse.org/linuxtools/job/linuxtools-gerrit/6053/ : FAILURE

-------------------------------------
author: Braxton Mccarthy
date: 2014-03-24 21:52:31.000000000

Patch Set 1: Code-Review-1

The test fails because it tries to insert null in the map, and ConcurrentHashMap does not support null values or keys.

Does the run-time code ever insert null values in there? (hard to tell without annotations ;) ). If no, one option would be to fix the test to not use null values. Another option would be to use a synchronizedMap instead:

  fChildren = Collections.synchronizedMap(new HashMap<String, TmfStatisticsTreeNode>());

Although this implementation locks "more" than the concurrent hashmap (the whole map is locked every time a writer tries to access it, whereas ConcurrentHashMap has more localized locking), it does support null values.

-------------------------------------
author: Ricky Reeves
date: 2014-03-25 11:33:28.000000000

Patch Set 1:

Oh, I didn't notice the build failure. Even though it doesn't make sense to have null values in the map, I'll change it to Collections.synchronizedMap(), because it does what we want to achieve. 

Thanks for pointing that out.

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