Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to akka


Published on

The author is managing editor of, which offers self-paced online courses that teach Introductory and Intermediate Scala and Play Framework.

  • Be the first to comment

Introduction to akka

  1. 1. Introduction to Akka 1.2 Mike Slinn SF Scala Meetup Nov 21, 2011
  2. 2.• Will replace scala.actors.Actor real soon now• Are managed by• ActorRefs are opaque (cannot inspect Actor properties or call methods)• Must communicate with Actors via messages sent to their ActorRef
  3. 3. Messages• Arrive at actor mailboxes in the order they were sent.• Actors can reply to messages, except• Only Actors can receive messages• If an actor is sent a message by a non-actor, no reply is possible
  4. 4. Actors and Dispatchers• Actors are scheduled by dispatchers• The default dispatcher works fine for many uses• Various dispatcher algorithms are available• Do not code to a specific dispatcher algorithm; the algorithm is usually defined in akka.conf
  5. 5. akka.stm.Ref• STM: Software Transactional Memory• Each Ref get/set is always atomic (wrapped in a transaction)• Transactions are (relatively) expensive
  6. 6. How to Obtain Partial Simulation Results?1.Create an inner class that accesses a property outside its scope, or2.Use an STM Ref• Inner class approach breaks OO encapsulation
  7. 7. Now we are ready to look at Hanuman