You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@celix.apache.org by GitBox <gi...@apache.org> on 2020/07/22 18:54:54 UTC

[GitHub] [celix] pnoltes commented on pull request #270: Add void promise

pnoltes commented on pull request #270:
URL: https://github.com/apache/celix/pull/270#issuecomment-662626819


   > There's a lot of code duplication, so I can imagine that there will be plenty of comments.
   > 
   > The only question I have remaining is the `Promise<void> resolveWith(Promise<T> with);` function. Can someone create a test showing the use of such a function?
   
    Promise can be used as way to see if something is done (ok or nok (onResolve on onFailure).
   
   The use case for resolving a void promise with a typed promise is (IMO) if you are not interested in the result downstream, but use want to use the promise as a sync.
   
   So for example you get Promise from some function (maybe 3rd party) where the double is the time it took to process, but in "our" API we just want to indicate whether were a done (success or failed). In this case you can create a Promise and resolve it with the Promise (regardless if the Promise is already resolved or not)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org