Actors, Mailboxes & Supervision
The Actor Model on the JVM
Akka is a JVM toolkit for concurrent, distributed, resilient applications built on the actor model — independent, isolated units (actors) communicating exclusively via async messages, each owning its state privately with no shared mutable memory. This sidesteps classic shared-memory concurrency bugs by design, trading manual locks/mutexes for a higher-level, message-passing abstraction.
Mailboxes & Sequential Processing
Each actor has a mailbox — a queue holding incoming messages until the actor's dispatcher schedules it to process the next one. An actor handles messages sequentially, one at a time, which is exactly why its internal state never needs explicit locking: concurrency comes from having many actors, not multiple threads touching one actor's state simultaneously.
ActorSystem — the Runtime Container
The ActorSystem is the top-level entry point, managing the actor hierarchy's lifecycle, scheduling, and the underlying thread pools (dispatchers) that execute actors.
Supervision — "Let It Crash"
override val supervisorStrategy = OneForOneStrategy() {
case _: ArithmeticException => Resume
case _: NullPointerException => Restart
case _: Exception => Escalate
}Directly inspired by Erlang/OTP: a parent actor supervises children and decides how to respond to a failure (restart, stop, resume, or escalate), delegating fault handling rather than requiring every actor to defensively handle every possible error internally.
Keep your own version of these notes — editable, searchable, and organised by your stack.
Start free