vavr
vavr copied to clipboard
Decouple Thread management from FutureImpl
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.