< prev index next >

test/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java

Print this page

        

*** 118,128 **** throw new AssociationFailure(desc + " failed: entry does not exist"); } } }; ! int ps = Runtime.getRuntime().availableProcessors(); Stream<CompletableFuture> runners = IntStream.range(0, ps) .mapToObj(i -> sr.get()) .map(CompletableFuture::runAsync); CompletableFuture all = CompletableFuture.allOf( --- 118,129 ---- throw new AssociationFailure(desc + " failed: entry does not exist"); } } }; ! // Bound concurrency to avoid degenerate performance ! int ps = Math.min(Runtime.getRuntime().availableProcessors(), 32); Stream<CompletableFuture> runners = IntStream.range(0, ps) .mapToObj(i -> sr.get()) .map(CompletableFuture::runAsync); CompletableFuture all = CompletableFuture.allOf(
< prev index next >