[concurrency-interest] Future Get/Done Race Condition

Martin Buchholz Martin.Buchholz at Sun.COM
Wed Jan 31 14:01:36 EST 2007

Whether done() should complete before releasing threads blocked
in get() is tricky.  If we were to start from scratch, I would
prefer to have the more predictable serialized behavior where
returning from get() guarantees that done() has completed.
But compatibility trumps possibly better design here.

We have a very similar issue with ThreadPoolExecutor.terminated().
There the historical behavior is the opposite.
Threads returning from ThreadPoolExecutor.awaitTermination()
have a guarantee that terminated() has completed,
and we have been careful to preserve that behavior in
in-progress changes to ThreadPoolExecutor.

In neither case do we currently document the behavior.
I think that's a bug.

I filed Sun bug

6519887: Document whether "done" methods execute before waiters are released


More information about the Concurrency-interest mailing list