Gpars withExistingPool Error jsr166y.ForkJoinPool not found

1.5k views Asked by At

I have updated from 'org.codehaus.gpars:gpars:1.0.0' to 'org.codehaus.gpars:gpars:1.1.0'. My code works fine in 1.0.0 but in version 1.1.0 I cannot find jsr166y.ForkJoinPool anymore.

How do I get the correct ForkJoinPool?

The code I am using is:

import groovyx.gpars.GParsPool
import jsr166y.ForkJoinPool

class Test {
   def pool = new ForkJoinPool()

   def executeAsync(args, closure = null) {
    if(!closure) {
        closure = args
        args = null
    }

    GParsPool.withExistingPool(pool) {
        closure.callAsync(args)
    }
   }
}

I have to import java.util.concurrent.ForkJoinPool to get the ForkJoinPool class. But at runtime I get the following error:

| Error 2013-08-01 13:26:45,807 [http-nio-8080-exec-4] ERROR 
errors.GrailsExceptionResolver  - ClassNotFoundException occurred when processing   
request: [POST] /testpackage/test/saveAll - parameters:
jsr166y.ForkJoinPool. Stacktrace follows: 
Message: jsr166y.ForkJoinPool
Line | Method
->>  175 | findClass                 in org.codehaus.groovy.tools.RootLoader
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    423 | loadClass                 in java.lang.ClassLoader
|    147 | loadClass . . . . . . . . in org.codehaus.groovy.tools.RootLoader
|    356 | loadClass                 in java.lang.ClassLoader
|   2451 | privateGetDeclaredMethods in java.lang.Class
|   1810 | getDeclaredMethods        in     ''
|     46 | getLocked . . . . . . . . in org.codehaus.groovy.util.LazyReference
|     33 | get                       in     ''
|    318 | saveAll . . . . . . . . . in testpackage.UploadImageController
|    195 | doFilter                  in   
grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter . . . . . . . .  in grails.plugin.cache.web.filter.AbstractFilter
|   1145 | runWorker                 in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run                       in java.lang.Thread
| Compiling 1 source files.
1

There are 1 answers

0
AudioBubble On BEST ANSWER

Update your BuildConfog.groovy as:

compile 'org.codehaus.gpars:gpars:1.1.0'
compile 'org.codehaus.jsr166-mirror:jsr166y:1.7.0'

This should work for you.