Scala actor:调度多线程应用程序的两种不同方法

发布于 2024-11-18 05:32:42 字数 265 浏览 5 评论 0原文

我是 Scala Actors 的新手。我计划构建一个应用程序,其中有多个盒式磁带,每个盒式磁带执行特定的 http 调用并定期检索+保留一些信息。稳健性是最重要的。到目前为止,这些是我想到的方法:

  1. 围绕 TimerTask 构建应用程序, 从 Actor 扩展墨盒并 定期调用他们的 .act (或 我应该给他们发消息吗? 有什么区别?)
  2. 从 Actor 扩展并使用超时 定期运行它们。

有人可以阐明这些差异吗?

I'm new to Scala Actors. What I plan to build is an application that has several cartridges that each do a specific http call and retrieve+persist some info periodically. Robustness is what matters the most. So far these are the ways I've thought of:

  1. Build the app around a TimerTask,
    extend cartridges from Actor and
    call their .act s periodically (or
    should I send them messages instead?
    what's the difference?)
  2. Extend from Actor and use Timeouts
    to periodically run them.

Can someone shed some light on the differences?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何必那么矫情 2024-11-25 05:32:42

Scala Actors 将与 Akka 合并,因此请查看 http://akka.io

您可以使用 Akka 的“调度程序”要安排消息以一定的时间间隔发送给参与者,这一切都在文档中:

http://akka.io/docs/akka/1.1.3/

希望这有帮助,

干杯,

Scala Actors will be merged with Akka so take a look at http://akka.io,

You can use Akka's "Scheduler" to schedule messages to be sent to actors at certain intervals, it's all in the docs:

http://akka.io/docs/akka/1.1.3/

Hope this helps,

Cheers,

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文