package test.thread;

import java.util.HashMap;
import java.util.Map;

public class Helper {
  private static Map<String, Map<Long, Long>> m_maps = new HashMap<>();

  public static Map<Long, Long> getMap(String className) {
    synchronized(m_maps) {
      Map<Long, Long> result = m_maps.get(className);
      if (result == null) {
        // TODO a synchronizedMap will break MultiThreadedDependentSampleTest
        // a not synchronizedMap will __sometimes__ break ParallelITestTest
        //result = Collections.synchronizedMap(new HashMap<Long, Long>());
        result = new HashMap<>();
        m_maps.put(className, result);
      }
      return result;
    }
//    System.out.println("Putting class:" + className + " result:" + result);

  }

  public static void reset() {
    m_maps = new HashMap<>();
  }
}

@@ -34,20 +34,16 @@
 va.util.
-Hash
 Map;%0D%0Aim
@@ -53,24 +53,49 @@
 t java.util.
+concurrent.ConcurrentHash
 Map;%0D%0A%0D%0Apubl
@@ -126,24 +126,30 @@
 vate static 
+final 
 Map%3CString, 
@@ -170,32 +170,42 @@
 %3E%3E m_maps = new 
+Concurrent
 HashMap%3C%3E();%0D%0A%0D%0A
@@ -272,540 +272,82 @@
     
-synchronized(m_maps) %7B%0D%0A      Map%3CLong, Long%3E result = m_maps.get(className);%0D%0A      if (result == null) %7B%0D%0A        // TODO a synchronizedMap will break MultiThreadedDependentSampleTest%0D%0A        // a not synchronizedMap will __sometimes__ break ParallelITestTest%0D%0A        //result = Collections.synchronizedMap(new HashMap%3CLong, Long%3E());%0D%0A        result = new HashMap%3C%3E();%0D%0A        m_maps.put(className, result);%0D%0A      %7D%0D%0A      return result;%0D%0A    %7D%0D%0A//    System.out.println(%22Putting class:%22 + className + %22 result:%22 + result);%0D%0A
+return m_maps.computeIfAbsent(className, cn -%3E new ConcurrentHashMap%3C%3E());
 %0D%0A  
@@ -397,24 +397,14 @@
 maps
- = new HashMap%3C%3E
+.clear
 ();%0D

Fix Helper.getMap() thread safety issues