JActor 4.4.0 为定时器增加了 MailboxFactory。

JActor 是一个 Java 的 Actor 模式的实现,经过测试在 i5 CPU 上可支持每秒钟发送超过亿条消息,可能是目前最快的。这相当于是 Scala 的 Actor 的纯 Java 版本。

示例代码:

JAMailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1);
try {
    Mailbox mailbox = mailboxFactory.createMailbox();
    JCActor a = new JCActor(mailbox);
    (new Include(Greeter.class)).call(a);
    JAFuture future = new JAFuture();
    String greeting = (new Hi()).send(future, a);
    System.out.println(greeting);
} catch (Exception e) {
    e.printStackTrace();
} finally {
    mailboxFactory.close();
}

相关文章:

  • 2021-06-21
  • 2022-02-08
  • 2021-07-21
  • 2022-03-05
  • 2022-03-08
  • 2021-10-06
  • 2022-01-16
猜你喜欢
  • 2021-06-08
  • 2022-02-13
  • 2021-10-08
  • 2021-11-20
  • 2021-10-06
  • 2021-10-23
  • 2021-05-19
相关资源
相似解决方案