cescoffier / vertx-completable-future

An implementation of CompletableFuture for Vert.x
Apache License 2.0
78 stars 28 forks source link

Make *BlockingAsync unordered + allow custom worker executors #16

Closed silmeth closed 5 years ago

silmeth commented 5 years ago

Currently one cannot easily create multiple VertxCompletableFutures on the same context that would execute in parallel – as using supplyBlockingAsync and runBlockingAsync runs provided Supplier/Runnable using the default Context’s executeBlocking() method, which runs code in order, which means that all futures created in such a way are executed sequentially in order of their creation, regardless of the size of the Vertx’s worker executor.

This pull request changes that, passing explicitly false for the ordered parameter when calling the executeBlocking method, and additionally provides methods supplyBlockingAsyncOn() and runBlockingAsyncOn() which accept custom WorkerExecutor instance on which the provided callback will get executed.