Yes, synchronized blocks are reentrant. ReentrantLock is also reentrant, and if you want to encode blocks yourself, you can use it instead, since it has more flexibility / functionality.
I would make sure that any lock is final If the lock object cannot be final, this is almost certainly an error (or a source of confusion)
For comparison purposes, not all locks in Java are reentrant. FileLock is not the way it passes the request directly to the OS.
source share