O'Reilly logo

Mastering Concurrency Programming with Java 9 - Second Edition by Javier Fernández González

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Actors

Actors implement a message-passing concurrency model. Each actor is an independent object that sends and receives messages from/to other actors. There's no association between actors and threads. A thread can execute different actors and an actor can be executed by different threads. Actors don't have shared-state and GPars guarantees that the code of the actor will be executed, so no messages will be lost. Memory will also be synchronized each time a thread is assigned to an actor, so no explicit synchronization is needed. There are two types of actors:

  • Stateless actors: Based on the DynamicDispatchActor or the ReactiveActor classes. They have no track of what messages have arrived before.
  • Stateful actors: Based on the DefaultActor ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required