You are previewing Actors in Scala.
O'Reilly logo
Actors in Scala

Book Description

Recent trends in computer architecture make concurrency and parallelism an essential ingredient of efficient program execution. The actor model of concurrency allows you to express real-world concurrency in a natural way using concurrent processes that communicate via asynchronous messages.

Scala is a programming language for the Java virtual machine, providing excellent support for both object-oriented and functional programming. By including a powerful actor framework in its standard library, Scala offers a compelling approach to tackle concurrent programming. Scala's actors let you apply the actor concurrency model to the JVM, enabling real-world solutions that are efficient, scalable, and robust.

Published by Artima, this is the first book on Scala's actors, co-authored by the creator and lead maintainer, Philipp Haller, and Frank Sommers. Starting with the fundamentals of the actor concurrency model, this book offers a comprehensive tutorial on practical programming with actors in Scala. It enables you to leverage the full power of today's and tomorrow's multi-core processors by describing both basic and advanced features of Scala's actor framework in-depth.

Table of Contents

  1. Cover
  2. Title Page
  3. Table of Contents
  4. Foreword
  5. Acknowledgments
  6. Introduction
    1. Who should read this book
    2. How to use this book
    3. EBook features
    4. Typographic conventions
    5. Content overview
    6. Resources
    7. Source code
    8. Errata
  7. Concurrency Everywhere
    1. 1.1 A shift toward parallel hardware
    2. 1.2 Actors versus threads
    3. 1.3 Scalability
    4. 1.4 A high-level perspective on concurrency
    5. 1.5 The indeterministic soda machine
    6. 1.6 Programming the data center
  8. Messages All the Way Up
    1. 2.1 Control flow and data flow
    2. 2.2 Actors and messages
    3. 2.3 Actor creation
    4. 2.4 Actor events
    5. 2.5 Asynchronous communication
    6. 2.6 You've got mail: indeterminacy and the role of the arbiter
    7. 2.7 Actor life cycle
  9. Scala's Language Support for Actors
    1. 3.1 A scalable language
    2. 3.2 Immutable and mutable state
    3. 3.3 Methods and classes
    4. 3.4 First-class functions
    5. 3.5 Functions as control structures
    6. 3.6 Pattern matching and case classes
  10. Actor Chat
    1. 4.1 Defining message classes
    2. 4.2 Processing messages
    3. 4.3 Sending actor messages
  11. Event-Based Programming
    1. 5.1 Events versus threads
    2. 5.2 Making actors event-based: react
    3. Exceptions and react
    4. Recursive methods and react
    5. 5.3 Event-based futures
  12. Exceptions, Actor Termination, and Shutdown
    1. 6.1 Simple exception handling
    2. 6.2 Monitoring actors
  13. Customizing Actor Execution
    1. 7.1 Pluggable schedulers
    2. 7.2 Managed blocking
  14. Remote Actors
    1. 8.1 Creating remote actors
    2. 8.2 Remote communication
    3. 8.3 A remote start service
  15. Distributed and Parallel Computing
    1. 9.1 MapReduce
    2. 9.2 Reliable broadcast
  16. Akka Actors
    1. 10.1 Creating Akka actors
    2. Scaladoc and ActorRef
    3. 10.2 ActorRefs
    4. 10.3 Inter-actor interaction, interactively
    5. 10.4 Message handling
    6. 10.5 Remote actors in Akka
  17. API Overview
    1. 11.1 The actor traits Reactor, ReplyReactor, and Actor
    2. 11.2 Control structures
    3. 11.3 Futures
    4. 11.4 Channels
    5. 11.5 Remote Actors API
  18. Bibliography
  19. About the Authors
    1. Philipp Haller
    2. Frank Sommers
  20. Book Index