This section explains what happens under the hood to understand the things well. If you are not interested in knowing this, skip this section and move on to the next parts of this chapter.
On a high level, Actor Toolkit components perform the following steps:
- ActorRef makes a call to its !() function.
- ActorRef hands over the message to the dispatcher.
- Dispatcher enqueues the message into the mailbox.
- Dispatcher creates an executorService (Executor).
- Dispatcher creates a mailbox thread—mbox.
- Dispatcher makes a call to the execute() function of executorService:
executorService.execute(mbox)
- The executorService.execute() method invokes the mailbox's run() function:
mbox.run()
- Mailbox's run() function dequeues the message.
- Mailbox's run() function hands over that message to the...