Skip to content

Commit

Permalink
refactor: 낙관적락 AOP 코드 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
jemin committed Jan 28, 2024
1 parent 7417162 commit 47226ae
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class OptimisticLockAspect {
@Around("@annotation(cmc.mellyserver.common.aspect.lock.OptimisticLock)")
public Object lock(final ProceedingJoinPoint joinPoint) throws Throwable {

log.info(OPTIMISTIC_LOCK_AOP_ENTRY); // 낙관적 락 진입 확인
log.info(OPTIMISTIC_LOCK_AOP_ENTRY);

MethodSignature signature = (MethodSignature)joinPoint.getSignature();
Method method = signature.getMethod();
Expand All @@ -47,11 +47,8 @@ public Object lock(final ProceedingJoinPoint joinPoint) throws Throwable {
long waitTime = lock.waitTime();

for (int i = 0; i < retryCount; i++) {

try {
return joinPoint.proceed();

// 낙관적 락 버전 충돌 케이스 & 데드락 발생 케이스
} catch (OptimisticLockingFailureException | CannotAcquireLockException ex) {
log.info(OPTIMISTIC_LOCK_RETRY);
Thread.sleep(waitTime);
Expand Down

0 comments on commit 47226ae

Please sign in to comment.