This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Help needed with synchronization Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Help needed with synchronization" Watch "Help needed with synchronization" New topic
Author

Help needed with synchronization

Varun Goenka
Ranch Hand

Joined: Mar 09, 2009
Posts: 37
Once a thread enters the monitor on a synchronized method it cannot be blocked or it cannot sleep right?


From The Demon,
with love.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16687
    
  19

Varun Goenka wrote:Once a thread enters the monitor on a synchronized method it cannot be blocked or it cannot sleep right?


No. Owning a lock doesn't mean that it can't block on another lock. Or (doesn't mean that it) can't block on other resources such as I/O. And it can certainly call the Thread.sleep() method.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: Help needed with synchronization
 
Similar Threads
Connection Refused Exception
The new beta test on Javaranch
calculator - SCJP exam
how to pass vector in sendredirect mrthod in jsp
What you learnt from your favourite TV cartoon hero