celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [celix] pnoltes commented on pull request #270: Add void promise
Date Wed, 22 Jul 2020 18:54:54 GMT

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



Mime
View raw message