What happens when a static synchronized method is called by two threads using different instances at the same time? Is it possible? The object lock is used for non static synchronized method but what type lock is used for static synchronized method?
What happens when a static synchronized method is called by two threads using different
Share
It is the same as synchronizing on the
Classobject implementing the method, so yes, it is possible, and yes, the mechanism effectively ignores the instance fro which the method is called:is a shortcut for writing this: