如何更改scala代码,以便它不会定义超时

时间:2014-05-14 04:21:54

标签: scala

我想从下面的代码中删除超时定义,因此它不会在定义的时间段内超时。我怎样才能做到这一点?

val futureString: Future[String] = myTestActor.ask(Message).mapTo[String]
val timeoutFuture: Future[String] = play.api.libs.concurrent.Promise.timeout(throw new         TimeoutException(), 5 seconds)

Async {
  Future.firstCompletedOf(Seq(futureString, timeoutFuture)) map {
    case result: String => println("got message " + result)
  } recover {
    case _: TimeoutException => "Timed out?"
 }
}

0 个答案:

没有答案