|
Multithreading: Difference between "synchronized static" and ""synchronized" |
|
|
|
|
Written by Sleepy Egg
|
|
Thursday, 23 June 2005 |
|
A thread calls "synchronized static" method, it needs to lock the Class object. A thread calls "synchronized" method, it needs to lock the instance object.
When a thead is holding Class object lock, it won't block threads trying to aquire an instance object lock. When a thread is holding an instance object lock, it won't block threads trying to aquire Class object lock.
|