소스 검색

add debug logging for locks, only log ifDebugEnabled

tags/2.0.1
Jonathan Cobb 4 년 전
부모
커밋
b4e6a58077
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. +4
    -1
      wizard-server/src/main/java/org/cobbzilla/wizard/cache/redis/RedisService.java

+ 4
- 1
wizard-server/src/main/java/org/cobbzilla/wizard/cache/redis/RedisService.java 파일 보기

@@ -220,18 +220,21 @@ public class RedisService {
}

public String lock(String key, long lockTimeout, long deadlockTimeout) {
log.debug("lock("+key+") starting");
key = key + LOCK_SUFFIX;
final String uuid = UUID.randomUUID().toString();
String lockVal = get(key);
final long start = now();
while ((lockVal == null || !lockVal.equals(uuid)) && (now() - start < lockTimeout)) {
set(key, uuid, NX, EX, deadlockTimeout/1000);
log.debug("lock("+key+") locked with uuid="+uuid);
lockVal = get(key);
log.debug("lock("+key+") after locking with uuid="+uuid+", lockVal="+lockVal);
}
if (lockVal == null || !lockVal.equals(uuid)) {
return die("lock: timeout locking "+key);
}
log.info("lock: LOCKED "+key);
log.debug("lock: LOCKED "+key+" = "+lockVal);
return uuid;
}



불러오는 중...
취소
저장