• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread B has to start after completion of 5 instances of Thread A

 
Shiaber Shaam
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have 5 instances of Thread A running.

threada1.start();
threada2.start()
threada3.start()
threada4.start()
threada5.start()

after these 5 threads get complete, i want to start an instance of thread b. may i know how to implement this.


Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64617
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to take the time to compose descriptive subjects for your posts; read this for more information.

A title such as "need a soluton" is not helpful. What would happen if all posts had such a title?

Please go back and change your post to add a more meaningful subject by clicking the button on your post.
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could write a multiple thread executor that fires an event once it's done.
 
Ireneusz Kordal
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use CountDownLatch to make one thread wait for completion of other threads:
http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/CountDownLatch.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic