• Post Reply Bookmark Topic Watch Topic
  • New Topic

Which thread comes first from wait().

 
sachin Dhanvijay
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to know when we notify all threads from a wait() method which thread comes out first ...means it comes through priority or through ageing.
sachin.
 
Jim Baiter
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's random - there's no determining which will acquire the lock after notifyAll() is called.
 
ANAND RAMKUMAR
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you cannot determine which thread comes out of the wait state and to seek the lock state of the object.ageing is not the concept there.
 
Peter Haggar
author
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One thing you can do to determine which thread runs after a notifyAll is implement the Specific Notification Pattern found here.
Peter Haggar
------------------
Senior Software Engineer, IBM
author of: Practical Java
 
Ipsita Naravane
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow! great information.
Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!