aspose file tools
The moose likes Threads and Synchronization and the fly likes A question about notify() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "A question about notify()" Watch "A question about notify()" New topic
Author

A question about notify()

grant dyg
Greenhorn

Joined: Aug 18, 2001
Posts: 3
Hi,all.
I want to make it clear if the method notify() only wakes up a thread which has called the method wait() ?
I got a program.I find that there's no wait() in it.So what does notify() do ?
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Yes. - Nothing.
- Peter
Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

Bartender,
I think notify wothout wait() will do nothing. That means, no compile time exception or runtime error and just only goes to check whether any thread is waiting wait set/pool there? Found nothiny as waiting so returns.....correct me if i m wrong.

------------------
azaman
[This message has been edited by Ashik uzzaman (edited August 19, 2001).]


Ashik Uzzaman
Senior Member of Technical Staff, Salesforce.com, San Francisco, CA, USA.
Marcela Blei
Ranch Hand

Joined: Jun 28, 2000
Posts: 477
Ashik:
You are right, but remember that this method should be called by a thread that is the owner of this object's monitor. So if it's not called in that way you will get an: IllegalMonitorStateException
grant dyg
Greenhorn

Joined: Aug 18, 2001
Posts: 3
Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A question about notify()
 
Similar Threads
Example of wait and notify
Simple Question
where is the notify?
Blocked vs Waiting Thread
Cleared SCJP 6