aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes wait and notify problem from K&B. 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 and notify problem from K&B." Watch "wait and notify problem from K&B." New topic
Author

wait and notify problem from K&B.

aruna dabas
Greenhorn

Joined: Dec 16, 2008
Posts: 27


Dear Friends
i am not understanding that when i am commenting notify() still why i am getting total in main ThreadA .please explain me.
Thanking You.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

Unfortunately, what you are seeing is an implementation detail of the join() method... I explained it a couple of times before. It may be worth it to search the forums...

Here is one of those times...

http://www.coderanch.com/t/234368/Threads-Synchronization/wait-without-notify

Hope this helps,
Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
aruna dabas
Greenhorn

Joined: Dec 16, 2008
Posts: 27
i got it ,,,Thanks Henry
Rafael Angarita
Ranch Hand

Joined: Jan 09, 2009
Posts: 67
I'm sorry guys. But now I'm a little bit confused.

For me these examples of "wait without notify" just work in the same way as using the join() method. I'm just waiting for a thread to die.

Am I missing something here?


Rafael Angarita.
SCJP 6.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9304
    
  17

Rafael you are right that this works like waiting for a thread to die. But this depends on the internal implementation of the Thread class. So this will not be tested in SCJP...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Rafael Angarita
Ranch Hand

Joined: Jan 09, 2009
Posts: 67
Thank you very much!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: wait and notify problem from K&B.