aspose file tools
The moose likes Threads and Synchronization and the fly likes Difference between wait and join Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "Difference between wait and join" Watch "Difference between wait and join" New topic
Author

Difference between wait and join

Sunil Palicha
Greenhorn

Joined: Jul 24, 2002
Posts: 11
What is the difference between wait and join ?

One difference that I am aware of is wait needs to be used in
synchronized method or block whereas join can come right after
start().

Can join be used to act as wait ? If yes, under what conditions ?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16695
    
  19

Originally posted by Sunil Palicha:
What is the difference between wait and join ?

One difference that I am aware of is wait needs to be used in
synchronized method or block whereas join can come right after
start().

Can join be used to act as wait ? If yes, under what conditions ?


The join() method is used to wait for a thread to complete execution, and the wait() method is used to wait for a notification to be sent on an object. The two conditions are pretty distinctive.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Difference between wait and join
 
Similar Threads
difference between wait() and sleep()
left outer join Vs right outer join
wait() vs sleep()
inner join Vs outer join
thread