--- jsr166/src/test/tck/ConcurrentHashMapTest.java 2016/08/22 18:38:28 1.50 +++ jsr166/src/test/tck/ConcurrentHashMapTest.java 2017/03/11 17:33:32 1.53 @@ -16,8 +16,6 @@ import java.util.Map; import java.util.Random; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import junit.framework.Test; import junit.framework.TestSuite; @@ -34,7 +32,7 @@ public class ConcurrentHashMapTest exten * Returns a new map from Integers 1-5 to Strings "A"-"E". */ private static ConcurrentHashMap map5() { - ConcurrentHashMap map = new ConcurrentHashMap(5); + ConcurrentHashMap map = new ConcurrentHashMap<>(5); assertTrue(map.isEmpty()); map.put(one, "A"); map.put(two, "B"); @@ -837,30 +835,4 @@ public class ConcurrentHashMapTest exten assertEquals(mapSize, map.size()); } - /** - * Tests performance of computeIfAbsent when the element is present. - * See JDK-8161372 - * ant -Djsr166.tckTestClass=ConcurrentHashMapTest -Djsr166.methodFilter=testcomputeIfAbsent_performance -Djsr166.expensiveTests=true tck - */ - public void testcomputeIfAbsent_performance() { - final int mapSize = 20; - final int iterations = expensiveTests ? (1 << 23) : mapSize * 2; - final int threads = expensiveTests ? 10 : 2; - final ConcurrentHashMap map = new ConcurrentHashMap<>(); - for (int i = 0; i < mapSize; i++) - map.put(i, i); - final ExecutorService pool = Executors.newFixedThreadPool(2); - try (PoolCleaner cleaner = cleaner(pool)) { - Runnable r = new CheckedRunnable() { - public void realRun() { - int result = 0; - for (int i = 0; i < iterations; i++) - result += map.computeIfAbsent(i % mapSize, (k) -> k + k); - if (result == -42) throw new Error(); - }}; - for (int i = 0; i < threads; i++) - pool.execute(r); - } - } - }