1package test.thread;
2
3import java.util.HashMap;
4import java.util.Map;
5
6public class Helper {
7  private static Map<String, Map<Long, Long>> m_maps = new HashMap<>();
8
9  public static Map<Long, Long> getMap(String className) {
10    synchronized(m_maps) {
11      Map<Long, Long> result = m_maps.get(className);
12      if (result == null) {
13        // TODO a synchronizedMap will break MultiThreadedDependentSampleTest
14        // a not synchronizedMap will __sometimes__ break ParallelITestTest
15        //result = Collections.synchronizedMap(new HashMap<Long, Long>());
16        result = new HashMap<>();
17        m_maps.put(className, result);
18      }
19      return result;
20    }
21//    System.out.println("Putting class:" + className + " result:" + result);
22
23  }
24
25  public static void reset() {
26    m_maps = new HashMap<>();
27  }
28}
29