You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Alex Rogachevsky <al...@px100systems.com> on 2015/08/24 22:38:23 UTC

Named cluster-wide lock

I need to lock the entire cluster during loading. Different cluster nodes
load different caches concurrently from different "databases" on startup. I
adapted the IgniteCountDownLatch for that, however a more "atomic"
cluster-wide lock would be nice. Something like 

*java.util.concurrent.locks.Lock Ignite.lock(String lockName, Long
timeout)*, where /timeout/ can be null to wait indefinitely or zero to just
try the lock.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Named-cluster-wide-lock-tp1115.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Named cluster-wide lock

Posted by vkulichenko <va...@gmail.com>.
Alex Rogachevsky wrote
> Thanks. I remember thinking about that when I implemented that framework
> feature, but something prevented me from doing it. I think I didn't want
> to do an extra step and check if the cache exists. I want it to be a
> one-step atomic operation. Let me revisit it.

Alex,

I don't think you need any additional steps, just use
Ignite.getOrCreateCache() method. It will do all required synchronization
internally.

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Named-cluster-wide-lock-tp1115p1130.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Named cluster-wide lock

Posted by Alex Rogachevsky <al...@px100systems.com>.
Thanks. I remember thinking about that when I implemented that framework
feature, but something prevented me from doing it. I think I didn't want to
do an extra step and check if the cache exists. I want it to be a one-step
atomic operation. Let me revisit it.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Named-cluster-wide-lock-tp1115p1128.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: Named cluster-wide lock

Posted by vkulichenko <va...@gmail.com>.
Hi Alex,

You can create transactional IgniteCache and use explicit lock provided by
IgniteCache.lock(K key) method. 
Adding distributed locks as well as other synchronization structures is on
the roadmap: https://issues.apache.org/jira/browse/IGNITE-641

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Named-cluster-wide-lock-tp1115p1116.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.