Reactor lifecycle

Every reactor goes through a certain set of stages during its lifetime, which are jointly called a reactor lifecycle. When the reactor enters a specific stage, it emits a lifecycle event. These lifecycle events are dispatched on a special daemon event stream called sysEvents. Every reactor is created with this special event stream.

The reactor lifecycle can be summarized as follows:

  • After calling the spawn method, the reactor is scheduled for execution. Its constructor is started asynchronously, and immediately after that, a ReactorStarted event is dispatched.
  • Then, whenever the reactor gets execution time, the ReactorScheduled event gets dispatched. After that, events get dispatched on normal event streams.
  • When the scheduling system ...

Get Learning Concurrent Programming in Scala - Second Edition 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.