Why after acquiring lock control is going to second lock.lock() statement? Isin't it should wait indefinitely over 2nd lock statement for acquiring it?
Is it because I am acquiring lock in single thread?
Class LockTest{
private static final ReentrantLock lock = new ReentrantLock();
public static void main(String[] args){
lock.lock();
System.out.println(lock.isLocked());
lock.lock();
System.out.println(lock.isLocked());
}
}
Output:
true
true