Reports use of the synchronized modifier on methods. There are several reasons a synchronized modifier on a method may be a bad idea: First, as a rule as little work as possible should be performed under a lock. Therefore it is often better to use a synchronized statement and move as much of the methods code outside the synchronized region. Second, it makes synchronization part of the external interface of the class. This makes a future change to a different locking mechanism difficult. Third, it makes it hard to track just who is locking on a given object. And fourth, it makes a denial-of-service attack possible, either on purpose or it can happen easily by accident when subclassing.

As an alternative, consider synchronizing on a private final lock object, access to which can be completely controlled.