aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes wait() method in Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "wait() method in Thread" Watch "wait() method in Thread" New topic
Author

wait() method in Thread

Anthony Karta
Ranch Hand

Joined: Aug 09, 2004
Posts: 342
please assume this code are inside a instance



looks weir to me.

synchronized(b) --> "get" lock on b instance
b.wait()--> "release" lock on b instance ??

my questions are:
1. #<b>releases the lock</b># --> whose lock? b or a?
2. #<b>the lock</b># --> again whose lock? b or a?


SCJP 5
Xiao Song
Greenhorn

Joined: Aug 29, 2006
Posts: 17
Where is a??


scjping.......
Sanjeev Singh
Ranch Hand

Joined: Nov 01, 2006
Posts: 381
Anthony,

Anthony posted November 23, 2006 04:42 PM
looks weir to me.

synchronized(b) --> "get" lock on b instance
b.wait()--> "release" lock on b instance ??


This is the only truth.


~Sanjeev Singh<br />SCJP 1.5
Bin Qian
Greenhorn

Joined: Sep 13, 2006
Posts: 18
Hello:

my questions are:
1. #<b>releases the lock</b># --> whose lock? b or a?
2. #<b>the lock</b># --> again whose lock? b or a?

I think
1.release all the locks the b holds
2.b
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wait() method in Thread