When building an API it is a good practice to code to an interface so it seems like returning CompletionStage seems like a best approach. However I realized that I happen to be always calling .toCompletableFuture after getting the CompletionStage. What is the recommended approach in this case?
See my reply at https://stackoverflow.com/a/49158702/1113842
Like Holger asked, why do you call toCompletableFuture?
complete/cancel it? Most applications provide their own mechanisms for completing the stage. Thus, it's not necessary to expose these methods.get? This should be avoided in async programming.If the answers are no to both questions, you should return CompletionStage.
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