Using Typed Actors
The actors we saw so far accepted messages. We passed different types of messages, a String, tuples, case classes/custom messages, and so on. Yet, passing these messages felt quite different from the regular method calls we’re used to in everyday programming. Typed actors help bridge that gap by allowing us to make regular method calls and translating them to messages under the covers. Think of a typed actor as an active object, which runs in its own single lightweight event-driven thread, with an intercepting proxy to turn normal-looking method calls into asynchronous nonblocking messages.
Since typed actors convert regular method calls into messages under the covers, we can enjoy the benefits of static typing to the fullest ...
Get Programming Concurrency on the JVM 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.