I was looking at the source code of java.uti.concurrent.locks.AbstractQueuedSynchronizer and the acquire() method looks something like this -
public final void acquire(int arg) {
if (!tryAcquire(arg) &&
acquireQueued(addWaiter(Node.EXCLUSIVE), arg))
Thread.currentThread().interrupt();
}
Why does it interrupt the thread calling acquire()? If there was check somewhere in the threads run() method, then it might pass after calling acquire() which is probably undesirable and unthought of?
Anybody care to shed light on why the above piece of code does this?