Want Erlang concurrency but are stuck with Java: 4 Alternatives (+1)

You’ve by now have read a lot about Erlang style concurrency. In Erlang actors are sending messages to inboxes of other actors and react to messages in their own inbox. The advantage of this approach with immutable messages is that you can’t get as easily in a deadlock as with basic Java concurrency with synchronized and threads. A simple ping pong example looks like this:

Two actors sending each other ping and pong messages with the ! symbol and acting on those with receive. Although there is more to concurrency than Erlang style message passing, as I’ve written lately in a post, for some problems it’s best and easiest to use message passing.

Is Erlang the next Java, but you are stuck with Java and can’t use Erlang style concurrency? Wrong.

There are concurrency solutions for Java which mimic Erlang style concurrency:

Update: “One clarification: ActorFoundry just uses Kilim’s weaver and therefore is not built on top of Kilim.” (see comments, thanks)
Update 2: Another option sugested by Diego Martinelli is to use Functional Java

Sujit Pal has written a comprehensive post comparing the performance of those frameworks with lots of example code:

Over the past few weeks, I’ve been looking at various (Java and Scala based) Actor frameworks. In an attempt to understand the API of these frameworks, I’ve been porting the same toy example consisting of three pipelined Actors responding to a bunch of requests shoved down one end of the pipe. To get a feel for how they compare, performance-wise, to one another, I’ve also been computing wallclock times for various request batch sizes.

And as Kilim has been shown to be as fast as Erlang – I’ve written about the fact here – these Java solutions do indeed look comparable to Erlang in the concurrency space.

What does this mean to your Java Enterprise?

Don’t worry about the multi-core future, Java has plenty to give for your multi-core platforms. And if you’re only stuck to the Java VM but not the Java language, you could go for Scala and gain some functional programming capabilities on top.

Thanks for listening. Hope you’ve learned something. As ever, please do share your thoughts and additional tips in the comments below, or on your own blog (I have trackbacks enabled).

41 thoughts on “Want Erlang concurrency but are stuck with Java: 4 Alternatives (+1)”

  1. Pingback: yandex ankara
  2. Pingback: yandex ankara
  3. Pingback: ????? ????? ????
  4. Pingback: here
  5. Pingback: ???
  6. Pingback: SEO Techniken
  7. Pingback: info
  8. Pingback: top steroid sites
  9. Pingback: trenbolone mix
  10. Pingback: Trisha
  11. Pingback: zaditen
  12. Pingback: more
  13. Pingback: purchase peptides
  14. Pingback: ankara escort
  15. Pingback: kryptodyne
  16. Pingback: aboutjoe
  17. Pingback: usteroids

Comments are closed.