Hi!
In a thread i try to get a lock. During shutdown of the application,
i call Thread.interrupt() to receive a InterruptedException in the thread.
Using version with lock.tryLock() the InterruptedException is catched.
With lock.lockInterruptibly() or tryLock(long var1, TimeUnit var3) i never get an InterruptedException.
How they differ ?
BTW: In the hazelcast lock test 'testLockInterruptibly' i saw the property OPERATION_CALL_TIMEOUT_MILLIS is set.
So lock.lockInterruptibly() will only throw an InterruptedException after this timeout expires ?
VERSION WORKING:
try {
while(!lock.tryLock()) {
Thread.sleep(300);
}
} catch (InterruptedException e) {
LOG.error(e.getMessage());
}
VERSION NOT WORKING:
try {
lock.lockInterruptibly();
} catch (InterruptedException e) {
LOG.error(e.getMessage());
}
BR
Andreas