Skip to content

Instantly share code, notes, and snippets.

@yossale
Created March 13, 2014 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yossale/9527253 to your computer and use it in GitHub Desktop.
Save yossale/9527253 to your computer and use it in GitHub Desktop.
def messageTo = { num ->
println(Thread.currentThread().name + " --> A message for you number $num")
}
def pool = Executors.newFixedThreadPool(10)
(1..1000).each { num ->
pool.submit({ messageTo(num) })
}
pool.awaitTermination(60, TimeUnit.SECONDS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment