Actor模式的Java实现 JActor

码农软件 · 软件分类 · 并发/并行处理框架 · 2019-09-03 08:42:35

软件介绍

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

示例代码:

// Create a mailbox factory with a pool of 10 threads.
MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(10);

// Create and initialize a Test actor.
Mailbox mailbox = mailboxFactory.createAsyncMailbox();//.createMailbox();
MyActor actor = new MyActor();
actor.initialize(mailbox);

// Send a MyRequest request and wait for completion.
JAFuture future = new JAFuture();
long ct = System.currentTimeMillis();
System.out.println(MyRequest.req.send(future, actor));
// Shut down the thread pool.
mailboxFactory.close();

 

本文地址:https://codercto.com/soft/d/13767.html

The Information

The Information

James Gleick / Vintage / 2012-3-6 / USD 16.95

James Gleick, the author of the best sellers Chaos and Genius, now brings us a work just as astonishing and masterly: a revelatory chronicle and meditation that shows how information has become th......一起来看看 《The Information》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

SHA 加密
SHA 加密

SHA 加密工具