gpars

How do I execute two tasks simultaneously and wait for the results in Groovy?

此生再无相见时 提交于 2019-11-30 20:38:49
I have a large processing task which I believe is ripe for being made more efficient with concurrency and parallelism. I had a look at the GPars docs and I found them quite confusing so I hope people here can help. The first task I would like to do in parallel currently looks like this: def providerOneProgrammes = providerOneProgrammeService.getProgrammes(timeWindow) def providerTwoProgrammes = providerTwoProgrammeService.getProgrammes(timeWindow) both return a list of objects and both can be run in parallel. I would like to execute them together and then wait for them to finish before

How do I execute two tasks simultaneously and wait for the results in Groovy?

[亡魂溺海] 提交于 2019-11-30 04:55:17
问题 I have a large processing task which I believe is ripe for being made more efficient with concurrency and parallelism. I had a look at the GPars docs and I found them quite confusing so I hope people here can help. The first task I would like to do in parallel currently looks like this: def providerOneProgrammes = providerOneProgrammeService.getProgrammes(timeWindow) def providerTwoProgrammes = providerTwoProgrammeService.getProgrammes(timeWindow) both return a list of objects and both can be