ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkulichenko <valentin.kuliche...@gmail.com>
Subject Re: understanding Locks usage
Date Wed, 07 Sep 2016 20:53:56 GMT

javastuff.sam@gmail.com wrote
> Is there any other way to take a distributed lock which can be unlocked by
> owner thread, but does not need same LOCK instance? I mean unlock api
> finds and gets the lock instance automatically to unlock. I am not sure if
> IgniteLock can do that, not yet tried.

The answer is no. As I said, Ignite locks replicate the semantics of Java
locks. Why do you need different behavior?

javastuff.sam@gmail.com wrote
> 1. Is there any atomic api which can be used as fetchAndLock and
> putAndUnlock?

Use transactions for this. fetchAndLock is actually a transactional get().

javastuff.sam@gmail.com wrote
> 2. Is there concept of locking Key and locking cached entry? here is my
> understanding on difference between them -
> - Locking key - Distributed lock. Does not need existence of cache entry
> with that key. 
> - Locking Entry - Distributed lock. To lock entry, it need to exists in
> cache. Once locked all other thread access are read only.  

Current locks are exclusive, but there is a ticket in progress for
read-write lock: https://issues.apache.org/jira/browse/IGNITE-637. However,
I believe it will not depend on value existence. And again, I'm not sure I
understand a use case where it can be needed.


View this message in context: http://apache-ignite-users.70518.x6.nabble.com/understanding-Locks-usage-tp7489p7593.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

View raw message