jetlang

Project site
code.google.com
Description
Message based concurrency for Java
Last commit
8 years ago
License
New BSD License
Last release
4 years ago
Repository
http://jetlang.googlecode.com/svn/trunk/

Summary

Jetlang provides a high performance java threading library. The library is based upon Retlang.

The library is a complement to the java.util.concurrent package introduced in 1.5 and should be used for message based concurrency similar to event based actors in Scala.

The library does not provide remote messaging capabilities. It is designed specifically for high performance in-memory messaging.

Features

  • 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.
  • Powerful Async Request/Reply Support

Basic Example

        // 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();</pre><h3><a name="" /><a href="http://jetlang.googlecode.com/svn/site/apidocs/index.html" rel="nofollow">Browse the Api</a></h3><h3><a name="" /><a href="http://code.google.com/p/jetlang/source/browse/trunk/src/test/java/org/jetlang/examples/BasicExamples.java" rel="nofollow">More Examples</a></h3>

Social media

  • delicious 223
  • diigo 2
  • ff_comments 14
  • google 38
  • twitter 21

Latest releases

You might also like...

Comments

Source Code Commits

  • 367. Don't schedule tasks when interval==0 (8 years ago)
  • 367. Don't schedule tasks when interval==0 (8 years ago)
  • 366. Make PoolFiber public so custom fiber factories can be written. (8 years ago)
  • 366. Make PoolFiber public so custom fiber factories can be written. (8 years ago)
  • 366. Make PoolFiber public so custom fiber factories can be written. (8 years ago)

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There's no test like production” - Anon