Chapter 9Actors in Groovy, Java, JRuby, and Scala

In business, as in war, surprise is worth as much as force.

Paul Graham

We worked with actors in the previous chapter. We will learn how to program with them in some of the popular JVM languages in this chapter.

Erlang popularized the interprocess actor-based model. Scala brought an Erlang-style model to intraprocess communication. Clojure does not directly support actors—Rich Hickey expresses his reasons for that at http://clojure.org/state#actors. Clojure supports agents that represent shared mutable identities but with asynchronous, independent, mutually exclusive updates. We will discuss Clojure agents in Appendix 1, Clojure Agents.

We could use Akka actors from Groovy; instead, we’ll ...

Get Programming Concurrency on the JVM now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.