posted 10 years ago
I think, if methods in a particular class are interdependent for state of the object, then it is good to use this/any single object as lock.
If two methods are not dependent (do not get affected by each others operations on the state of the object) then it is not harm to use different locks for the methods. This case is explained in your code.
Here, there is no reason that class used for lock should contain the state variables of synchronized block.