Skip to content

Instantly share code, notes, and snippets.

@newgeekorder
Created November 27, 2013 13:40
Show Gist options
  • Save newgeekorder/7675835 to your computer and use it in GitHub Desktop.
Save newgeekorder/7675835 to your computer and use it in GitHub Desktop.
parallel http calls
import static groovyx.gpars.GParsExecutorsPool.withPool
def restUrl = ["http://url1", "http://url2", "http://url3"]
def poolSize =restUrl.length
withPool(poolSize) {
poolSize.times {
Closure callUrl = {"http://google.com".toURL().withReader {}}
callUrl.callAsync();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment