Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Thread Priority

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I wanted to know that if notify() method is given to multiple threads that are waiting, what is the process or order in which they are woken up? I know they are woken up arbitarily, but what I specifically want to know is that how can a user wake up a particular thread of his choice if he wants to do work with it?
 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
One way that you can handle this is to keep a reference of the Thread's name that you want to wake up. Use the notifyAll() method instead of notify() and put all threads that don't have the name that you are looking for back asleep. Hope this helps.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
You asked the same question in the JavaRanch forum, and that has been moved to the correct forum here
I'm going to ask for this thread to be closed and direct anyone who wants to participate to the other forum.
Please don't ask the same question in multiple forums.
Dave
    Bookmark Topic Watch Topic
  • New Topic