I found this example here Data Parallelism
GParsPool.withPool() {
Closure longLastingCalculation = {calculate()}
Closure fastCalculation = longLastingCalculation.async()
Future result=fastCalculation()
//do stuff while calculation performs …
println result.get()
}
I find it a bit extensive. Is there a way to shorten it?
Maybe:
GParsPool.withPool() {
Future result = calculate().async()
//do stuff while calculation performs …
println result.get()
}
Would that work?
If not, is there another way?