Scala 中的异步编码
Possible Duplicate:
What is the Scala equivalent of F#'s async workflows?
Is there an equivalent to F# async workflows in Scala ? I would like to use this to crawl webpages concurrently.
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要并行异步执行任务,只需使用
Actor.actor
方法:要执行任务并等待结果,请使用 futures:
对于更复杂的工作流程,请查看 Scala(或 Akka)actor 。您还可以查看允许异步 IO 操作的 java NIO。
To execute a task asynchronously in parallel, simply use
Actor.actor
method:To execute a task and wait for a result, use futures:
For more complex workflows, have a look at Scala (or Akka) actors. You can also have a look at java NIO which allows async IO operations.