The type is actually misleading because the function is not supposed to convert the `Future[T]` into a `T`; it rather incidentally is handed a Future that can be queried for completion in order to abort a computation, and at the same time it is supposed to produce the computation result. When you invoke the second element of the returned tuple the thread on which the Future is being computed will be interrupted (i.e. this is a belt-and-suspenders approach).
Hope this helps, Roland On Mon, Jun 2, 2014 at 11:12 AM, √iktor Ҡlang <[email protected]> wrote: > The Future[A] => A is a function that will produce an A, but it gets a > Future[A] that will, if ever completed, be completed with a > CancellationException, you can then use this Future to abort your > computation. > > > On Mon, Jun 2, 2014 at 7:23 AM, Stan Domeshok <[email protected]> wrote: > >> I am running Scala Play 2.2.2 as the front end of for Java library. >> Certain calls into the java library are extremely long running (order of >> hours). >> I am looking for some mechanism to be able to run these calls >> asynchronously but to also be able to cancel them once they have started, >> essentially killing the thread that is running them. Akka actors don't seem >> to fit the bill as as soon as I make the service call, the actor mailbox >> queue will block until the call is over leaving it unresponsive to Kill >> messages. I have been looking for an implementation of cancellable futures, >> but have not found anything that will deterministically kill the Future. >> >> The closest that I have come is a gist written by Viktor some time ago ( >> https://gist.github.com/viktorklang/5409467) but I am unable to figure >> out how to use it correctly. The (Future[A] -> A) in the type is completely >> throwing me off and I have no idea how to pass in my actual workload. >> >> Can anyone offer any advice for this situation? I would prefer to be >> able to use some kind of high level primitive rather than having to fall >> back to using Callable[T]. >> >> -- >> >>>>>>>>>> Read the docs: http://akka.io/docs/ >> >>>>>>>>>> Check the FAQ: >> http://doc.akka.io/docs/akka/current/additional/faq.html >> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user >> --- >> You received this message because you are subscribed to the Google Groups >> "Akka User List" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/akka-user. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Cheers, > √ > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ > >>>>>>>>>> Check the FAQ: > http://doc.akka.io/docs/akka/current/additional/faq.html > >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user > --- > You received this message because you are subscribed to the Google Groups > "Akka User List" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > -- Akka Team Typesafe - The software stack for applications that scale Blog: letitcrash.com Twitter: @akkateam -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
