LockContainer.acquireLock() to return Lock instead of boolean?
--------------------------------------------------------------
Key: ISPN-351
URL:
https://jira.jboss.org/jira/browse/ISPN-351
Project: Infinispan
Issue Type: Feature Request
Reporter: Galder Zamarreno
Assignee: Galder Zamarreno
Fix For: 4.0.0.Final
I'm finding LockContainer and its implementations such as
ReentrantPerEntryLockContainer very useful in other projects for example when you wanna
maintain some kind of per-key locks.
However, discussing with Brian, he made a good point about the LockContainer API:
boolean acquireLock(Object key, long timeout, TimeUnit unit) throws
InterruptedException;
Lock getLock(Object key);
Sometimes, you wanna acquire the lock and keep the lock around. To do so right now, u
have to make two calls, one to acquireLock and one to getLock. It'd be better if
acquireLock was enhanced to be this way:
Lock acquireLock(Object key, long timeout, TimeUnit unit) throws
InterruptedException;
So, if acquireLock suceeds, it returns the lock immediately. If it doesn't, it could
simply return null.
WDYT?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: