vavr icon indicating copy to clipboard operation
vavr copied to clipboard

Decouple Thread management from FutureImpl

Open danieldietrich opened this issue 6 years ago • 0 comments

Goal

Increase maintainability of the core concurrency implementation of Future.

Motivation

In #2194 we made Vavr's Future independent of ExecutorService. Instead Future takes the more general Executor.

Internally, this means

// before (v0.9.3)
java.util.concurrent.Future job = executorService.submit(callable);

// after (v0.10.0)
executor.execute(() -> {
    this.thread = Thread.currentThread(); // clever trick to get the worker Thread!
    // do the work
});

Meanwhile, our Future supports an increasing number of features. The goal of this issue is to decouple the core Future implementation from Thread management, like cancellation and blocking.

danieldietrich avatar Jan 19 '19 22:01 danieldietrich