Quick revision
The short answer
Intrinsic locks are reentrant: a thread that already holds a monitor can acquire it again without blocking. The JVM tracks the owning thread and a hold count, increments it on each entry, decrements it on each exit, and releases the lock only when it reaches zero. This lets a synchronized method call another synchronized method on the same object, and lets a subclass's synchronized override call super's synchronized method. Without reentrancy, a thread would deadlock on itself in these common cases. Reentrancy is per thread, so it never lets a different thread in.
What to remember
In this answer, we saw that intrinsic locks are reentrant: the JVM records the owning thread and a hold count, lets the owner enter again by incrementing the count, and releases the monitor only when the count returns to zero. That makes it safe for synchronized methods to call each other on the same object and for synchronized overrides to call super. Without reentrancy, a thread would deadlock on itself in these everyday cases, and because reentrancy is per thread, it never lets another thread past the lock.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Intrinsic locks are reentrant: a thread that already holds a monitor can acquire it again without blocking. The JVM tracks the owning thread and a hold count, increments it on each entry, decrements it on each exit, and releases the lock only when it reaches zero. This lets a synchronized method call another synchronized method on the same object, and lets a subclass's synchronized override call super's synchronized method. Without reentrancy, a thread would deadlock on itself in these common cases. Reentrancy is per thread, so it never lets a different thread in.
Why this question is asked
Reentrancy is one of those properties we rely on every day without noticing. Every time one synchronized method calls another on the same object, it is reentrancy that keeps the program from freezing. Interviewers ask about it to check that we understand who owns a lock and what the JVM keeps track of, and because the same idea appears in ReentrantLock, whose name says it. In this answer, we will recap what owning a monitor means, see how the hold count works, look at the two everyday cases that need reentrancy, imagine the deadlock without it, and be clear about what reentrancy does not do.
1A Quick Recap of Lock Ownership
When a thread enters a synchronized method or block, it acquires the object's monitor and becomes its owner. While it owns the monitor, any other thread that tries to enter code synchronized on the same object blocks. A lock that is reentrant, also called recursive, adds one rule: if the thread trying to acquire it is already the owner, it succeeds immediately.
So the question the JVM asks on entry is not just is this lock free, but is it free, or is it already mine? That second check is what reentrancy means.
2How the Hold Count Works
To support re-entry, the JVM keeps two pieces of information for a held monitor: the owning thread and a count of how many times that thread has entered without leaving. Each entry increases the count, each exit decreases it, and the monitor becomes free for other threads only when the count goes back to zero.
- Is the monitor free?YesTake it, owner = me, count = 1NoGo to the next check
- Am I already the owner?Yescount + 1, enter without waitingNoBlock until it is released
- On each exit: count - 1release only when count reaches 0
3 steps in order. Play them, or step through them one at a time.
Notice that the lock is not released when log() returns, because deposit() is still running and still needs it. Only the outermost exit releases the monitor. That is exactly what we want: other threads must not see the account halfway through deposit().
3Case 1: A Synchronized Method Calling Another
The deposit and log example is the first everyday case. Classes are full of synchronized public methods that call each other: a transfer() that calls withdraw() and deposit(), or an addAll() that calls add() in a loop. Each inner call tries to lock the same this that the outer call already holds. With reentrancy that just raises the count; without it, every such design would have to split each method into a locked public version and an unlocked private helper.
4Case 2: A Subclass Override Calling super
The second case is inheritance. A subclass overrides a synchronized method, also synchronized, and calls the parent's version. Both methods lock the same object, because there is only one object: the subclass instance is the parent instance.
Without reentrancy, super.doSomething() would wait for a lock that its own thread holds, and the program would hang on the very first call.
5What Would Go Wrong Without Reentrancy
If monitors were not reentrant, a thread trying to enter a lock it already holds would see the lock as taken and block, waiting for the owner to release it. But the owner is the waiting thread itself, so it can never release it. That is a self-deadlock: one thread, one lock, stuck forever, and no other thread is even involved.
It would appear in the most innocent code, any time one synchronized method calls another on the same object, directly or through a chain of calls, or through super. Non-reentrant locks do exist in other environments, and code written for them has to be structured very carefully to avoid nested acquisition. Java chose reentrancy so that ordinary object-oriented code just works.
6What Reentrancy Does Not Do
Reentrancy is strictly per thread. A different thread arriving at the same monitor still blocks, whatever the hold count is. It also does not help with two different locks: a thread holding lock A that tries to get lock B, held by another thread that wants A, still deadlocks. And it does not release the lock partway: wait() is the only operation that releases a monitor before the outermost exit, and it releases all holds at once and restores the count when it returns.
The same model applies to ReentrantLock. Its getHoldCount() method shows the count directly, and each lock() must be matched by exactly one unlock() in a finally block, or the lock stays held.
7Follow-up questions
Does reentrancy have a cost?
Very little. The JVM has to record the owner and count, but HotSpot handles a recursive entry on the fast path without contention with other threads. The real cost of synchronized comes from contention, not from re-entry.
Is ReentrantReadWriteLock reentrant for both read and write locks?
Yes, a thread can re-acquire either lock it holds, and a writer may also acquire the read lock. But a reader cannot upgrade to the write lock: a thread holding the read lock that asks for the write lock waits forever, because the write lock needs all read locks released, including its own.
What happens to the hold count when wait() is called?
wait() releases the monitor completely, whatever the count, so other threads can enter. When the thread is woken and reacquires the monitor, the JVM restores its previous hold count, so the outer synchronized frames still hold the lock as before.
8Conclusion
In this answer, we saw that intrinsic locks are reentrant: the JVM records the owning thread and a hold count, lets the owner enter again by incrementing the count, and releases the monitor only when the count returns to zero. That makes it safe for synchronized methods to call each other on the same object and for synchronized overrides to call super. Without reentrancy, a thread would deadlock on itself in these everyday cases, and because reentrancy is per thread, it never lets another thread past the lock.
Open with
Reentrant means a thread that already holds a monitor can acquire it again without blocking. The JVM keeps track of which thread owns the monitor and a hold count.
Then, if they want more
When the owner enters another synchronized block or method on the same object, the count goes up, each exit brings it down, and the monitor is only released for other threads when the count reaches zero. So the lock stays held until the outermost synchronized frame finishes, which is what keeps the object consistent.
This matters in two very common cases. One synchronized method calling another on the same object, like deposit calling a synchronized log method, and a subclass with a synchronized override calling super.doSomething, which locks the same object again.
If intrinsic locks were not reentrant, the inner acquisition would block waiting for the owner to release the lock, but the owner is the same thread, so it would deadlock on itself on the first call. Reentrancy is per thread, though: a different thread still has to wait, and it does nothing for deadlocks between two different locks. ReentrantLock works the same way, and getHoldCount shows the count.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- java.util.concurrent, package documentation, JLS chapter 17, Threads and Locks
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "What does it mean that intrinsic locks are reentrant, and what would go wrong if they...": https://scrivio-interview-library.netlify.app/java/synchronization/24c9f28dc8/