• Post Reply 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

Wait inside Synchronize doubt

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well can any other thread call a synchronized method
when some other thread has already called wait intside that method

Remember its a sync method and a thread is already inside and due to some condition has called wait.

Can some other thread call that sync method at this point of time.

Or do i need to wake that thread using notify and then when it completes some other thread can access that sync method.

Anyways Merry Christmas
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Calling wait on an object relinquishes any lock(s) that the thread already had on that object, so, any other thread can enter that synchronized block/method.
FYI, Thread.sleep() does not relinquishes the locks.
 
Abhijit Choudhury
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thnx Nitesh got it
 
reply
    Bookmark Topic Watch Topic
  • New Topic