Groovy/Gpars で以下の並列処理を想定します....
def result
GParsPool.withPool(5){
result = idList.collectParallel{processItem(it)}
}
は単なる配列リストであり、 でアクセスまたは操作するスレッドがないresultと仮定すると、明示的に同期する必要がありますか? 代わりにこれを行うべきかどうかを知る必要があります...resultprocessItem()result
def result = Collections.synchronizedList( new ArrayList())
GParsPool.withPool(5){
result = idList.collectParallel{processItem(it)}
}