[infinispan-dev] Time for a tryLock() ?

Mircea Markus mircea.markus at jboss.com
Fri Apr 27 05:19:39 EDT 2012


On 27 Apr 2012, at 12:05, Dan Berindei wrote:

> On Fri, Apr 27, 2012 at 11:22 AM, Mircea Markus <mircea.markus at jboss.com> wrote:
>> 
>> On 26 Apr 2012, at 18:29, Dan Berindei wrote:
>> 
>>> On Thu, Apr 26, 2012 at 3:09 PM, Manik Surtani <manik at jboss.org> wrote:
>>>> 
>>>> On 26 Apr 2012, at 13:05, Dan Berindei wrote:
>>>> 
>>>> What seems to be missing is an overload with a custom timeout, it may
>>>> be useful to try locking with a shorter timeout in the first attempt
>>>> (maybe even 0?) like we do for deadlock detection.
>>>> 
>>>> 
>>>> There is a flag for that.
>>>> 
>>>> https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/context/Flag.java#L79
>>>> 
>>> 
>>> Forgot about that one :)
>>> But still, it only allows a 0 timeout, so it's not exactly what I had
>>> in mind - which would be a custom timeout per operation.
>> Flags are Enum and not parametrizable, I guess we'd need to enhance the API to allow associating a param with a Flag as well.
> 
> I wasn't thinking of a flag, I was thinking of a withTimeout(timeout)
> method on AdvancedCache. There may be other "flags" that could be
> customized with a value as well, but then you'd need to keep them in a
> map and it could be more trouble than it's worth.
I see.
> 
> The complication with withTimeout/tryLock OTOH is that as a user I'd
> expect it to limit everything, not just the lock acquisition - so it
> would have to override sync.replTimeout as well.
+1.




More information about the infinispan-dev mailing list