]
William Burns commented on JGRP-1278:
-------------------------------------
Also this is unrelated, but the Locking class doesn't have the MBean annotation
present to export the protocol via JMX. Some of the methods have jmx annotations already
on them, and would be great to be able call them to view all locks or release them if the
system somehow got in an inconsistent state.
LockService lock, tryLock methods don't work well with interrupt
----------------------------------------------------------------
Key: JGRP-1278
URL:
https://issues.jboss.org/browse/JGRP-1278
Project: JGroups
Issue Type: Bug
Affects Versions: 2.12
Reporter: William Burns
Assignee: Bela Ban
Attachments: Locking.java.patch
I have been trying out the new LockService class, which has been great to use.
However I began looking into stuff around interrupts, and while glancing at the actual
protocol code I became a little confused as to how the lock method would ignore an
interrupt and still acquire the lock. So I wrote up a simple test case, which can be
found in the Reproduce section.
Needless to say the lock method behaves completely differently than how I would have
expected if an interrupt was encountered. If the interrupt flag is set the lock method
would return immediately, making the caller think the lock was retrieved. However the
lock was not retrieved! Also not to mention the interrupt status was lost completely,
further preventing the interrupt from being checked in a later part of code.
Also the tryLock() method behaves somewhat in a similar fashion as lock. If the
interrupt status is set it will return false immediately and clear the interrupt status.
I would expect the code to still retrieve the lock if possible and leave the interrupt
flag set afterwards just like I would in the case of lock.
I did also test the lockInterruptibly, tryLock(long, TimeUnit) and those worked if the
interrupt flag was set before invoking it, by throwing an InterruptedException as
expected.
I didn't test any of the methods in regards to an interrupt being done in the middle
of waiting to acquire a lock.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: