About Actors Guild
Actors Guild is an experimental Java framework to make concurrent programming easier. It combines the concept of Actors with Futures. The result is a small API that let's you write concurrent, multi-threaded code almost like regular Java classes.
News
2010/02/23: Actors Guild is dead (probably)As you should have noticed, there has been no progress on AG in the last 6 months. The reason is simply that AG did not achieve what I had hoped, and I have gone on to pursue other things.
If you consider using AG in a project, you should be aware that it's unlikely that there will be any further development.
My current pet project is Jarfiller.com, a collection of very dense references and tutorials for Java developers.
2009/02/06: Actors Guild 0.6 released!Version 0.6 of the Actors Guild Framework is now available. The focus of this release was to improve the API, simplify some features like the @Model annotation, and make it more difficult to write incorrect actors. Here is a list of the most important changes:
- Property-based initialization (read more about it here)
- Stateless classes will now be verified at runtime
- For public non-@Message methods in actors the annotation ThreadSafe is now required
- The Model annotation can only be used for whole actors, not for single messages anymore
As always, it would be great to get feedback of any kind!
The focus of the next release will be performance. I hope to improve the performance of the scheduler, and will introduce a much faster way of copying Serializable message arguments.
I just released the first version of the Actors Guild Framework! Version 0.5 is ready for download. You can also visit the new site and read the tutorial.
Version 0.5 contains all the main features that I want to have in version 1.0. Still, please note that it is experimental software. There may be backward-incompatible changes in the API, in particular in the way actors are initialized. I would appreciate any feedback, especially concerning the API and how to make it even easier to use.
This is my current to-do list for version 1.0:
- support for dependency-injection in Actors
- Spring support
- run-time checks at the bytecode level to enforce the rules for Stateless messages
- faster copying of mutable (Serializable) message arguments
I hope that you give give Actors Guild a try, and please leave some feedback either here on the blog, or write to tim@actorsguildframework.org. Thanks!
Some Code
If you know how actors work, and maybe know some of the other Actor-based frameworks for Java (such as Jetlang and Kilim), here is some example code to give you a rough idea of how to use Actors Guild:abstract class Counter extends Actor { private int count; @Prop abstract int getInitialCount(); @Initializer public void init() { count = getInitialCount(); } @Message public AsyncResult<Integer> getCount() { return result(count); } @Message public AsyncResult<Void> add(int a) { count = count + a; return noResult(); } }
Creating the actor and using its messages:
Agent agent = new DefaultAgent(); // the Agent manages Actors Counter counter = agent.create(Counter.class, new Props("initialCount", 1)); counter.add(5).await(); // call add(), wait until message has been processed System.out.println("Result: "+counter.getCount().get()); // will print 6
In other words, it is very different from typical actor libraries. You don't have to implement a message loop. The framework will manage the actor's message queue for you. You only need to implement the messages as annotated methods with a special return type.
You can learn more about Actors Guild in the tutorial.