abelaska / jedis-lock

Jedis distributed lock support
203 stars 118 forks source link

JedisCluster support for JedisLock APIs #11

Open kaidul opened 7 years ago

kaidul commented 7 years ago

JedisCluster support for JedisLock APIs, class modified to generic type, jedis version updated to 2.6.0 which is minimum version for JedisCluster.

crossoverJie commented 6 years ago

When the lock timeout is automatically released, but the business has not been completed. This will cause concurrency problems.

Do you have any solution?

thx.

josephtaylor commented 5 years ago

Tests deleted, i guess that's one way of doing it lol

sagarsitap596 commented 5 years ago

Is this change working?? Can I get this change in new version?

sagarsitap596 commented 5 years ago

Map<String, JedisPool> redisNodesAndjedisPoolMap = jedisCluster.getClusterNodes(); List redisNodesIPs = new ArrayList<>(redisNodesAndjedisPoolMap.keySet()); Collections.sort(redisNodesIPs); JedisPool jedisPool = redisNodesAndjedisPoolMap.get(redisNodesIPs.get(0)); Jedis jedis = jedisPool.getResource(); JedisLock lock = new JedisLock(jedis, "myLock", 1, 5000); return lock.acquire();

I am trying to always take single node to to store lock. But no sucess. It always returs me false.