Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

A question about notify()  RSS feed

 
grant dyg
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. - Nothing.
- Peter
 
Ashik Uzzaman
Ranch Hand
Posts: 2373
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Marcela Blei
Ranch Hand
Posts: 477
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!