Java permits a lock to be acquired multiple times before being unlocked. Consider, for example, the case where one synchronized method in an object inlines another. The synchronization mechanisms in the VM must handle this, and consequently keep some kind of flag or reference count in order to determine which lock or unlock is the "real" one and which should be treated as a no-op.
See also Lock pairing and Lock token.