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

必然

必然

[美] 凯文·凯利 / 周峰、董理、金阳 / 译言·东西文库/电子工业出版社 / 2016-1 / 58.00元

凯文·凯利对于经济和社会发展的趋势有着深刻的见解。20年前,他的《失控》一书,便已预见了当下几乎所有的互联网经济热点概念,如:物联网、云计算、虚拟现实、网络社区、大众智慧、迭代等。此次,凯文·凯利在新书《必然》中,提到了未来20年的12种必然趋势。一起来看看 《必然》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具