On Mon, May 9, 2016 at 11:10 AM, Roger Riggs <roger.ri...@oracle.com> wrote:
> I'm not sure I understand what
>
> "a CompletableFuture-based API for cleanup actions."
>
> would look like or how it would be used.

I'm fuzzy myself, but the idea is that any asynchronous action that
will be completed in the future should be represented by a
CompletableFuture.  In this case, the asynchronous actions are
performed by the GC.  I imagine an API on e.g. WeakReference

CompletableFuture<Void> whenCleared()

and then a user can schedule follow-on actions in the executor of their choice.

WeakReference r = ...
r.whenCleared().thenRunAsync(...)

One idea is to throw away as much Cleaner machinery as possible to
reuse CompletableFuture machinery.  Or build on top...  All
concurrency machinery is hard for humans to understand.

Reply via email to