I would expect the following test to only print \"has been locked\" once. BUT it consequently prints the line.
public class LocKTest { @Test public void
The name is ReentrantLock, meaning you can re-enter if you already own the lock.
ReentrantLock
re-enter
If you wish to have the thread block, you could use for example a Semaphore with 1 (or more) permits.
Semaphore