The moose likes Threads and Synchronization and the fly likes Waiting for all threads to complete Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Waiting for all threads to complete" Watch "Waiting for all threads to complete" New topic
Author

Waiting for all threads to complete

Mark Miranda
Greenhorn

Joined: Feb 25, 2011
Posts: 23
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
Saloon Keeper

Joined: Oct 27, 2005
Posts: 18370

Call the join() method on all three threads. When all three methods have finished then so have all three threads.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Nomaan Butt
Ranch Hand

Joined: Oct 19, 2011
Posts: 54
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

Joined: Feb 25, 2011
Posts: 23
Thanks!
 
 
subject: Waiting for all threads to complete
 
Threads others viewed
Regarding FTP froma remote server
doubt from scjp book on threads
a question on multithreading
Logger question
Limit concurrent threads; report successful execution; terminating hung threads
developer file tools