object ThreadAPP extends App {
import scala.concurrent.ExecutionContext.Implicits.global
val future = Future {
println("done with the future"); "hello"
}
future foreach println
//Thread.sleep(5000)
}
import scala.concurrent.Future--
>>>>>>>>>> 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 a topic in the Google Groups "Akka User List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/akka-user/5mHkRKFYvDc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
Hi Maatary,
1) This is rather easily explored with the following incantation:
scala> Future { Thread.currentThread.isDaemon } foreach println
true
2) I am not sure I understand the question, would you mind elaborating?
Correction? I don't think I said main was a daemon, I said the Implicits.global executor must be. In any case your main thread delegates to other executors. Then, without the sleep, you run out of code and the VM exists. Because at that point main is dead and no other non-daemon threads are running. So whether main was daemon or not doesn't matter, it's dead now. You can then infer that Implicits.global must use daemon threads, *because* the VM exists.Adding the Thread.sleep keeps the current thread (main) alive long enough for the other executors to execute.