Concurrency craze

Groovy concurrency framework GPars readies itself for big release

Chris Mayer

Embracing the multicore age is key for Java and Groovy developers. GPars’ first full version will guide you along the way

Groovy’s arrival back in January 2007 added a bit of dynamism to the JVM. Now there was a new functional scripting language that kept its ties close to Java, but brought in concepts from other languages too.

Earlier in 2012, Groovy 2.0 introduced static type-checking amongst other features, solidifying its place within the JVM. During that time, we’ve seen a plethora of offshoot projects crop up, such as web framework Grails, desktop framework Griffon and build automation tool Gradle.

One project though has bided its time before releasing a 1.0 release. GPars, the concurrency preaching framework containing both Groovy and Java APIs, was created by Vaclav Pech three years ago, with concurrent programming only being carried out by the few back then. Now, a release candidate has surfaced, suggesting a final release is weeks away.

With the prevalence of multi-core hardware, writing concurrently and understanding parallelism is now a necessity for Java and Groovy developers if they want to stay with the pace. Higher level concepts such as actors and dataflow aren’t new, but finally entering the mainstream now the barriers are lower and the worth of using them substantially greater.

A general release was always on the cards sooner rather than later, and due to the complexity of parallelism, it was right for the GPars team to wait until the project was mature enough for the masses. The challenge is to make it intuitive enough for them to enjoy concurrent programming from the off.

Three distinct concepts are covered currently within GPars. At the lowest level, there are code-level helpers for parallel collections and asynchronous programming. GPars also contains constructs like actors (popularised by Scala) and data parallelism to help architectural design. Finally, agents for “shared mutable state protection” are provided to help in the case when mutable state can’t be avoided (5% of the time say GPars).

It seems that the three years in hibernation have done wonders for GPars – the team has thought of everything to help ease the eager Java or Groovy developer into the world of parallelism. Pech writes in the Reference Documentation that GPars is “very addictive.” He adds:

“Once you get hooked you won’t be able to code without it. May the world force you to write code in Java, you will still be able to benefit from most of GPars features.”

If you’re interested in learning about what GPars can make possible, check out the Github page for the project. Also, have a read of this excellent introductory tutorial to GPars from Pech himself, which appeared in Java Tech Journal in 2012.

Inline Feedbacks
View all comments