[infinispan-issues] [JBoss JIRA] Created: (ISPN-351) LockContainer.acquireLock() to return Lock instead of boolean?
Galder Zamarreno (JIRA)
jira-events at lists.jboss.org
Mon Feb 22 12:41:10 EST 2010
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: Manik Surtani
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: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the infinispan-issues
mailing list