if (currentLock.isExpiredOrMine(lockUUID)) {
//when two process run to here,the first one get the lock,and return true,but he get the lock,but the second one will grab it;
//the second one goto next recycle and get lock too,he really got the lock.
//there is two process get the lock.....and when first one will release the second one's lock,you know then will always recyle like this.
String oldValueStr = jedis.getSet(lockKeyPath, newLock.toString());
if (oldValueStr != null && oldValueStr.equals(currentValueStr)) {
this.lock = newLock;
return true;
}
}
}
i try to fix this , i think we should use watch to keep it in transaction
if (currentLock.isExpiredOrMine(lockUUID)) { //when two process run to here,the first one get the lock,and return true,but he get the lock,but the second one will grab it; //the second one goto next recycle and get lock too,he really got the lock. //there is two process get the lock.....and when first one will release the second one's lock,you know then will always recyle like this. String oldValueStr = jedis.getSet(lockKeyPath, newLock.toString()); if (oldValueStr != null && oldValueStr.equals(currentValueStr)) { this.lock = newLock; return true; } } } i try to fix this , i think we should use watch to keep it in transaction