Assume the following parallel process in Groovy/Gpars....
def result
GParsPool.withPool(5){
result = idList.collectParallel{processItem(it)}
}
If result
is just an array list, and, assuming no thread accesses or manipulates result
in processItem()
, does result
need to be explicitly synchronized? I need to know if I should be doing this instead...
def result = Collections.synchronizedList( new ArrayList())
GParsPool.withPool(5){
result = idList.collectParallel{processItem(it)}
}