Sunday, March 8, 2015

What will Happens when a Thread Can't Get the Lock on the required Object ?

When a thread tries to enter into a synchronized method and if the lock is already taken by another thread , then the thread trying to get the lock will be blocked on the object's lock. 
and the thread goes into a kind of pool for that particular object and sits there until the lock is released and the thread CAN again become runnable/running thread when the lock released on the object. but if there are many thread waiting for the objects lock then we cant say which thread will get a chance to occupy the lock on  the object

No comments:

Post a Comment

Scrum and Scrum master

Scrum  Scrum is a framework which helps a team to work together.  It is like a rugby team (the scrum name comes from rugby game). Scrum enco...