David S.
David S.

Reputation: 11200

Why Akka waits in this example?

I am reading this Akka document, and I don't understand how the master wait for the Result message.

At the bottom of the code, the master received a Calculate message

// start the calculation
master ! Calculate

But the ! message is a tell message which means it is asynchronous. Why the application does not exit after that line?

Upvotes: 2

Views: 48

Answers (1)

cmbaxter
cmbaxter

Reputation: 35463

I believe the default dispatcher for an Akka ActorSystem uses daemon threads and thus the JVM does not exit unless that ActorSystem is shut down. That's why the test will continue to run even though that tell is the last line that App.

Upvotes: 3

Related Questions