每个异步执行grails

时间:2015-11-24 14:56:00

标签: grails asynchronous

我希望这是异步执行的

    Map someotherMap = [{"10","dance"},{"2","stop"}]
    Map resultMap = [:]
    someotherMap.each { key, value ->
       doSomethingThatsAddsToResultMap(key,value,resultMap)
    }

然后我可以按照自己的意愿使用resultMap。

我试过了

    Map resultMap = [:]
    Map someotherMap = [{"10","dance"},{"2","stop"}]
    GParsPool.withPool {
        someotherMap.eachParallel { key,value  ->
            doSomethingThatsAddsToResultMap(key,value,resultMap)
        }
    }

任何想法我怎么能让这个工作?

0 个答案:

没有答案