Skip to content

Instantly share code, notes, and snippets.

@christophknabe
Created June 24, 2014 13:49
Show Gist options
  • Save christophknabe/9592ee2ee632bc514fda to your computer and use it in GitHub Desktop.
Save christophknabe/9592ee2ee632bc514fda to your computer and use it in GitHub Desktop.
Collecting ProductVersions of several servers.
val uris = Seq(
"spray.io", "www.wikipedia.org"
//TODO Works well with only 2 URIs, sometimes also with 3 URIs, but does not scale to e.g. 5 URIs!
// , "scala-lang.org"
// , "doc.akka.io", "public.beuth-hochschule.de/~knabe/", "fb6.beuth-hochschule.de", "stackoverflow.com/questions/tagged/scala"
// , "esperanto.de", "tatoeba.org"
)
//The futures are constructed immediately one after another and are then running.
val futures = uris.map(requestProductVersion)
//Collect the results of all requests:
val result = Future.sequence(futures)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment