• Post Reply Bookmark Topic Watch Topic
  • New Topic

Waiting for all threads to complete

 
Mark Miranda
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have 3 threads in my program running, how can I make it so that when all 3 are done. Then will my program will print out the message "All done"?

I have been looking around, but cannot seem to find what I'm looking for.

Thanks,


 
Rob Spoor
Sheriff
Posts: 20817
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Call the join() method on all three threads. When all three methods have finished then so have all three threads.
 
Nomaan Butt
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check the below thread, similar question was asked in it
http://www.coderanch.com/t/558517/threads/java/know-all-threads-pool-done
 
Mark Miranda
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!