[concurrency-interest] a question regarding nested synchronized()

Yechiel Feffer yechielf at gigaspaces.com
Mon Feb 20 08:15:50 EST 2006


Hi

Say a Thread  does:===========

synchronized(objectA)
{
....Something

  synchronized(objectB)
  {
....Something

   objectB.wait()

  }
}

  my questions:

1. is the command  objectB.wait();, which is called by the thread  ,
releasing the lock on object A too, or does objectA remains locked
   since it is not the monitor used for the wait() ?  (My guess is that
objectA remains locked)
2. If the answer to 1. is yes,  in which order are the locks released ?

Regrds,
Yechiel Fefer  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20060220/3b626d89/attachment.html


More information about the Concurrency-interest mailing list