我无法按照此处的说明创建 Future 。它说您可以Future
使用以下代码直接创建一个:
import akka.dispatch.Await
import akka.dispatch.Future
import akka.util.duration._
val future = Future {
"Hello" + "World"
}
val result = Await.result(future, 1 second)
使用完全相同的代码,我收到一条错误消息,说:error: could not find implicit value for parameter executor: akka.dispatch.ExecutionContext
. 我能找到的ExecutionContext
只是,你可以用它“做事”。在文档中,我发现的唯一一行是:
implicit val ec = ExecutionContect.fromExecutionService(yourExecutionServiceGoesHere)
但这对我没有用。有人对我有什么建议吗?如何在Future
不询问的情况下创建一个新的Actor
?