[
https://issues.jboss.org/browse/JGRP-1278?page=com.atlassian.jira.plugin....
]
Bela Ban commented on JGRP-1278:
--------------------------------
Thanks for the patch, William !
I'll take a look tomorrow. Any chance you can fork JGroups
(
github.com/belaban/JGroups) and then issue a pull request instead of sending me a patch ?
No big deal though if not, patches work fine for me, too !
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
Fix For: 2.12
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:
http://www.atlassian.com/software/jira