[infinispan-issues] [JBoss JIRA] Commented: (ISPN-351) LockContainer.acquireLock() to return Lock instead of boolean?

Manik Surtani (JIRA) jira-events at lists.jboss.org
Mon Feb 22 13:02:10 EST 2010


    [ https://jira.jboss.org/jira/browse/ISPN-351?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12515790#action_12515790 ] 

Manik Surtani commented on ISPN-351:
------------------------------------

I don't see why you'd want this, but sure, I'm OK with the change.

> 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