GPars has been designed as a concurrency library for the Groovy programming language. This naturally implies GPars is very friendly to Grails and Griffon frameworks and offers applications, which build on top of these frameworks, the ability to:

  • Run expensive computations in the background

  • Parallelize access to remote services or databases and so limit the effects of latency of these services

  • Leverage the high-level concurrency concepts like actors, agents, parallel collections, dataflow and others

To enable GPars in your Grails application, alter the BuildConfig.groovy file as follows:

BuildConfig Sample
1
2
3
4
5
6
7
repositories {
    mavenCentral()
    mavenRepo 'http://repository.jboss.org/maven2/'
}
dependencies {
    build 'org.codehaus.gpars:gpars:1.1.0'
}

In Griffon, use the following:

Griffon
1
2
3
4
5
6
7
8
9
10
11
12
13
griffon.project.dependency.resolution = {
    inherits "global"

    default dependencies
        repositories {
            griffonHome()
            mavenCentral()
        }
        dependencies {
            runtime org.codehaus.gpars:gpars:1.1.0
        }
    }
}

Once the dependency has been specified, you can start using GPars in your project. You may now want to check out the Groovy Fast Track to do your first GPars experiments. Alternatively visit the User Guide and have fun!