• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Concurrency in Groovy

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
Could somebody please tell me how to handle concurrency issues in Groovy?


regads
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At this point, it's exactly like you would handle concurrency in Java.
 
Rancher
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The best thing about Groovy concurrency is that Closure implements Runnable. So you can very easily kick off a process running in a new thread:



You should see the parallel printouts, something like this:

Thread[Thread-15,6,main]: 1
Thread[Thread-16,6,main]: 1
Thread[Thread-15,6,main]: 2
Thread[Thread-16,6,main]: 2
Thread[Thread-15,6,main]: 3
Thread[Thread-16,6,main]: 3
Thread[Thread-15,6,main]: 4
Thread[Thread-16,6,main]: 4
Thread[Thread-15,6,main]: 5
Thread[Thread-16,6,main]: 5

[ September 05, 2008: Message edited by: Matthew Taylor ]
 
I can't beleive you just said that. Now I need to calm down with this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic