1. Object lock key Only one can be mutually exclusive, in order to guarantee the uniqueness of shared variables
2. In the static method of the lock, and the instance method on the lock, the default is not the same, if the synchronization needs to make two locks.
3. The lock on a method of the same class comes from the object that called the method, and if the object calling the method is the same, then the lock must be the same, otherwise it will be different. For example, new A (). x () and new A (). x (), the object is different, the lock is different, if a's simple interest, it can be mutually exclusive.
4. Static method lock, can be locked with all other static methods of mutual exclusion
5. Static method lock, and Xx.class lock effect, directly belongs to the class
Reprint: http://greemranqq.iteye.com/blog/1974143
Synchronized lock common method and lock static method