Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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