[concurrency-interest] More CompletableFuture internal improvements

Doug Lea dl at cs.oswego.edu
Sat May 24 13:09:21 EDT 2014

The first of various improvements catching up after a very busy semester ...

While addressing the recursion issues in CompletableFuture, I
had a deja vu prediction that someday, someone would create
zillions of useless completion stages for CompletableFuture that
never fired, and then complain about space usage. This can happen
for example with unused sources of anyOf and "either" constructions.
With a fair amount of restructuring, it's possible to clean these out.
Which the updated version does. Comments and experience reports welcome.
(For those familiar with internals: this required merging
"Async" with Completion classes, which turns out to be a good
idea anyway because it further reduces footprint.)

The deja vu comes from similar experiences dealing with
cleanup in cases of time-outs on queues etc every millecond
for days.

Updated sources at


Also compiled into the jar at
that you can run with -Xbootclasspath


More information about the Concurrency-interest mailing list