I'm new to the GPARS-library and implementing it in our software at the moment.
It's no problem for me to use it instead of the normal groovy-methods like
[..].each{..}
->
[..].eachParallel{..}
But I'm wondering how to parallelize 2 tasks which are returning a value.
Without GPARS I would do it this way:
List<Thread> threads = []
def forecastData
def actualData
threads.add(Thread.start {
forecastData = cosmoSegmentationService.getForecastSegmentCharacteristics(dataset, planPeriod, thruPeriod)
})
threads.add(Thread.start {
actualData = cosmoSegmentationService.getMeasuredSegmentCharacteristics(dataset, fromPeriod, thruPeriodActual)
})
threads*.join()
// merge both datasets
def data = actualData + forecastData
But (how) can this be done with the GparsPool?