You are previewing Scala in Depth.

Scala in Depth

Cover of Scala in Depth by Foreword by: Martin Odersky... Published by Manning Publications
O'Reilly logo

Chapter 9. Actors

 

In this chapter
  • General design principles using actors
  • Knowing the difference between react and receive
  • Using typed communication and sealed message protocols
  • Limiting failures to zones using supervisors
  • Limiting starvation to zones using schedulers

 

Actors are an abstraction on a synchronous processes. They communicate to the external world by sending and receiving messages. An actor will process received messages sequentially in the order they’re received, but will handle only one message at a time. This is critical, because it means that actors can maintain state without explicit locks. Actors can also be asynchronous or synchronous. Most actors won’t block a thread when waiting for messages, although this can be ...

The best content for your career. Discover unlimited learning on demand for around $1/day.