I want to develop my application promise style using vertx and CompletableFuture fits really for this purpose but JVM uses fork/join on the background for CompletableFuture and this may break Vertx Thread Safety.
Do you have any idea or have used this feature on your project?
There is also https://github.com/cescoffier/vertx-completable-future. From the README:
This project provides the Completable Future API but enforces the Vert.x threading model:
- When using xAsync methods (without executor), the callbacks are called on the Vert.x context
- When using non-async, it uses the caller thread. If it's a Vert.x thread the same thread is used. If not called from a Vert.x thread, it still uses the caller thread
- When using xAsync methods with an Executor parameter, this executor is used to execute the callback (does not enforce the Vert.x thread system)
Haven't used yet, though.
Yes it does, here is an example http://qrman.github.io/posts/2015/08/28/callback_hell_completablefuture_ftw/
But I think JavaRx is the better solution because its supported as first class citizen by vert.x http://vertx.io/docs/vertx-rx/java/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With