(Quick Reference)
Agent implements a Clojure-like agent concept
import groovyx.gpars.agent.Agentdef jugMembers = new Agent<List>(['Me']) //add MejugMembers.send {it.add 'James'} //add Jamesfinal Thread t1 = Thread.start {
jugMembers {it.add 'Joe'} //add Joe (using the implicit call() method to send the function)
}final Thread t2 = Thread.start {
jugMembers << {it.add 'Dave'} //add Dave
jugMembers << {it.add 'Alice'} //add Alice
}[t1, t2]*.join()
println jugMembers.val
jugMembers.valAsync {println "Current members: $it"}System.in.read()
jugMembers.stop()