There is a difference between static synchronized and non synchronized. If method is non synchronized, it is not safe in multi threading system. When method is synchronized, before the VM starts running that method, it has to acquire a monitor, so only one thread has access to this method at the same time. For an instance method (non static), the lock acquired is the one associated with the object you're calling the method on. Situation is more complicated when synchronized method is marked as static also. In this way, the lock acquired is combined with a class (type) so only one thread has access to any static synchronized method at the same time. | 0 |
By: [email protected] On: Wed May 22 07:25:41 EDT 2013 0 392 0 | 392 |
Are You Satisfied :1Yes1No |