Actors in Groovy with GPars
To create actors, we have at least as many options in Groovy as in Java.
We can implement Akka actors in Groovy by extending Akka UntypedActor. Groovy allows us to extend from classes written in other JVM languages, so it’s a direct override of the onReceive method of UntypedActor. Within this method, we can check for the message type and perform appropriate actions.
We may also use one of the other actor frameworks available for Java. However, in this chapter we’ll use a concurrency library geared more toward Groovy—GPars.
GPars is a library written in Java that brings the love of programming concurrency to Groovy and Java. The Java’s performance and the sheer elegance of Groovy shine in GPars. It provides a number ...
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.