New Promise API methods; Overriding default async executor; Optimizations + Bug fixes
Bug fixes
The release contains single but very important bug fix - DependentPromise
interface now correctly overrides methods inherited from CompletionStage
(with DependentPromise
as a return type, previously it was Promise
)
Optimizations
- Avoid using of
CompletableFuture
wrappers inside internal code - useCompletableFuture
class itself - Optimize edge-cases for
Promises.any / anyStrict / atLeast / atLeastStrict
- Refactor common code used internally into separate internal utility class to minimize inter-relations between classes.
- Better wrapper for custom
CompletionStage
implementation that implementsFuture
interface as well (i.e. prefer delegation wherever possible) -- seeCompletionStageWrapper
+BlockingCompletionStageAdapter
- Custom
Promise
adapter forCompletionStage
that adds blockingFuture
API (previously it was done via implicit creation ofCompletableFuture
) -- seeCompletionStageWrapper
Enhancements and new API
The release adds an option to override default async Executor
for Promise
. Promise.defaultAsyncOn(Executor)
+ related adapters serves this purpose. Also, DependentPromise
extend this behavior for own declared methods (the ones these let user enlist origins).
Additionally. Promise.join()
method is added - technically, it's like a Promise.get()
but without throwing checked exceptions.