Reputation: 4880
I am trying to use gpars GParsPool.withExistingPool
in gpars 0.12
It expects a jsr166y.ForkJoinPool
but looks like in the jsr166y jar I have, there is no way to create that class(?). The only ones I can create are jsr166y.forkjoin.ForkJoinPool
like so:
FJPool fjPool = new FJPool(2);
jsr166y.forkjoin.ForkJoinPool pool = fjPool.getForkJoinPool();// tried fjPool.createPool as well
Notice the packeage is different. So I get a method signature error when I try to run. Any idea how to overcome this?
Upvotes: 1
Views: 979
Reputation: 1441
The ForkJoinPool class can be constructed directly using its constructor. Please, check that the following code works for you:
import jsr166y.ForkJoinPool
import groovyx.gpars.GParsPool
def pool = new ForkJoinPool()
GParsPool.withExistingPool(pool) {
println ([1, 2, 3, 4, 5].anyParallel{it > 3})
}
If not, I can only think of you using an incompatible version of jsr166y. The correct one is identified as 'org.codehaus.jsr166-mirror:jsr166y:1.7.0'.
Vaclav
Upvotes: 2