Actor模式的Java实现 JActor

openkk 13年前

JActor 是一个 Java 的 Actor 模式的实现,经过测试在 i5 CPU 上可支持每秒钟发送 8500万条消息,可能是目前最快的。这相当于是 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();  }

项目主页:http://www.open-open.com/lib/view/home/1334189664186