Lorsque je crée un avenir ad-hoc et l'appeler cela fonctionne bien.awaitAll ne fonctionne pas dans mon test
scala> val f = future {Thread.sleep(1000 * 60 * 1); println("Hi"); 20} f: scala.actors.Future[Int] = scala> f() Hi res39: Int = 20
Lorsque je crée le même futur et appelle awaitAll
cela ne fonctionne pas. Le awaitAll
renvoie None
comme si le futur n'était pas résolu.
scala> val f = future {Thread.sleep(1000 * 60 * 1); println("Hi"); 20} f: scala.actors.Future[Int] = scala> awaitAll(1000 * 60 * 2, f) Hi res40: List[Option[Any]] = List(None)
le même problème? http://stackoverflow.com/questions/9305845/how-to-get-somex-from-the-results-of-futuresawaitall –
@JCamphor Oui, probablement. Comment suggérez-vous de corriger le code ci-dessus? – Michael