RFR 8078645: removeIf(filter) in ConcurrentHashMap removes entries for which filter is false

Paul Sandoz paul.sandoz at oracle.com
Tue May 5 07:56:39 UTC 2015


On May 4, 2015, at 11:11 PM, Martin Buchholz <martinrb at google.com> wrote:
> Paul, thanks.
> 
> Looks good.  
> 
> Test uses some impressive machinery, but I like what we did in jsr166 tck tests for similar sorts of tests:
> - rename latch to "done"
> - rename barrier to "threadsStarted"
> - rename "map" to "entry" or "e"

That name was meant to correspond to the kind of entry, i changed it to mapSupplier.

> - if a worker thread throws, make sure the test fails, e.g. by defining a "CheckedRunnable" or using a real ThreadPool that returns Futures that can be checked in the main thread.
> - do you really want to swallow the exception from barrier.await?
> 
> But it's unfair to ask you to create a new jdk jtreg concurrency testlibrary when jsr166 maintainers failed to do so!
> 

Here's an update using CompletableFuture:

http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8078645-ConcurrentMap-views-removeIf/webrev/test/java/util/concurrent/ConcurrentMap/ConcurrentRemoveIf.java.html

Paul.




More information about the core-libs-dev mailing list