Howdy,

I'm looking at using Future/Promise to be thread-friendly in some code.

Background... Lift has Futures (or LAFuture... yeah... go ahead make fun of
the name... pronounce it with a French accent)... with Lift futures, one
can do:

future.foreach(v => /* do something with the value */)

If the Future has been realized (or satisfied in Lift parlance), then the
function executes in the current thread. If the Future has not been
realized, the function is executed on a thread-pool thread once the Future
has been realized. This means that we don't have to consume threads waiting
for a Future to finish its work... and we can continue a computation on the
thread-pool thread once the future has finished.

Is there a way to get a code block to execute when a Future (or Promise) is
realized?

As an adjunct to that question... in Lift, we have fast-fail Futures. You
can pass in List[Future[Box[X]]] and get a Future[Box[List[X]]]... but the
Box will be Empty if any of the Futures fail (return an Empty Box or a
Failure Box). The advantage is that if you fork off a bunch of requests to
external systems you can fail-fast with your uber request if any of the
systems fail.

Is there a similar facility in Clojure.

Thanks for your time and your help?

David


-- 
Telegram, Simply Beautiful CMS https://telegr.am
Lift, the simply functional web framework http://liftweb.net
Follow me: http://twitter.com/dpp
Blog: http://goodstuff.im

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to