JetlangJava高性能线程库
Jetlang 提供了一个高性能的Java线程库,该库是 JDK 1.5 中的 java.util.concurrent 包的补充,可用于基于并发消息机制的应用。该类库不提供远程的消息功能,其设计的宗旨是实现一个内存中的消息传递机制:
主要特点有:
- All messages to a particular Fiber are delivered sequentially. Components can easily keep state without synchronizing data access or worrying about thread races.
- Single Fiber interface that can be backed by a dedicated thread or a thread pool.
- Supports single or multiple subscribers for messages.
- Subscriptions for single events or event batching
- Single or recurring event scheduling
- High performance design optimized for low latency and high scalability
- Publishing is thread safe, allowing easy integration with other threading models.
- Low Lock Contention – Minimizing lock contention is critical for performance. Other concurrency solutions are limited by a single lock typically on a central thread pool or message queue. Jetlang is optimized for low lock contention. Without a central bottleneck, performance easily scales to the needs of the application.
// start thread backed receiver.
// Lighweight fibers can also be created using a thread pool
Fiber receiver = new ThreadFiber();
receiver.start();
// create java.util.concurrent.CountDownLatch to notify when message arrives
final CountDownLatch latch = new CountDownLatch(1);
// create channel to message between threads
Channel<String> channel = new MemoryChannel<String>();
Callback<String> onMsg = new Callback<String>() {
public void onMessage(String message) {
//open latch
latch.countDown();
}
};
//add subscription for message on receiver thread
channel.subscribe(receiver, onMsg);
//publish message to receive thread. the publish method is thread safe.
channel.publish("Hello");
//wait for receiving thread to receive message
latch.await(10, TimeUnit.SECONDS);
//shutdown thread
receiver.dispose();
评论
JSRunJavaScript线程库
JSRun是用来在JavaScript中实现多线程编程效果的程序库。示例代码:<scripttype="text/javascript">window.onload=function(){
JSRunJavaScript线程库
0
Quasar-JavaJava 轻量级线程库
Quasar是一个Java库,提供了高性能、轻量级的线程,类似Go语言的Channel,Erlang语言的Actor和其他异步编程工具。InMaven:<dependency> &l
Quasar-JavaJava 轻量级线程库
0
JsWorkerJavaScript线程封装库
JsWorker是一个封装了workder线程的小型JavaScript库,包含三种workers:GoogleGearsWorkerPoolWebWorkers使用window.setTimeout
JsWorkerJavaScript线程封装库
0
nanomsg高性能通信库
nanomsg是一个实现了几种“可扩展协议”的高性能通信库;可扩展协议的任务是定义多个应用系统如何通信,从而组成一个大的分布式系统。当前版本nanomsg支持以下协议:配对模式:简单的一对一的通信;总
nanomsg高性能通信库
0
wast高性能 Java 库
wast是一个轻量级且高性能java语言开发框架和工具包,集成了最快的json库之一和最快的yaml解析库,代码轻量,无任何依赖。 功能内置json模块在性能评测上远远超过曾经的fastjson和ja
wast高性能 Java 库
0