From 303f1448a2c8627781ee9c150afdfbed4099e957 Mon Sep 17 00:00:00 2001 From: wellbeing-dough Date: Mon, 22 Jul 2024 21:52:48 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20:=20lock=20AOP=20=EC=98=88=EC=99=B8?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/redisson/RedissonDistributedLockAop.java | 6 +++--- ...uisitionException.java => LockAcquisitionException.java} | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) rename src/main/java/kr/co/studyhubinu/studyhubserver/exception/apply/{StudyApplyLockAcquisitionException.java => LockAcquisitionException.java} (82%) diff --git a/src/main/java/kr/co/studyhubinu/studyhubserver/common/redisson/RedissonDistributedLockAop.java b/src/main/java/kr/co/studyhubinu/studyhubserver/common/redisson/RedissonDistributedLockAop.java index afffc25..d7dd5a0 100644 --- a/src/main/java/kr/co/studyhubinu/studyhubserver/common/redisson/RedissonDistributedLockAop.java +++ b/src/main/java/kr/co/studyhubinu/studyhubserver/common/redisson/RedissonDistributedLockAop.java @@ -1,6 +1,6 @@ package kr.co.studyhubinu.studyhubserver.common.redisson; -import kr.co.studyhubinu.studyhubserver.exception.apply.StudyApplyLockAcquisitionException; +import kr.co.studyhubinu.studyhubserver.exception.apply.LockAcquisitionException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; @@ -40,12 +40,12 @@ public Object around(ProceedingJoinPoint joinPoint) throws Throwable { available = lock.tryLock(LOCK_WAIT_TIME, LOCK_LEASE_TIME, TimeUnit.SECONDS); if (!available) { log.warn("Redisson GetLock Timeout {}", field); - throw new StudyApplyLockAcquisitionException(); + throw new LockAcquisitionException(); } result = joinPoint.proceed(); } catch (InterruptedException e) { - throw new StudyApplyLockAcquisitionException(); + throw new LockAcquisitionException(); } finally { if (available) { lock.unlock(); diff --git a/src/main/java/kr/co/studyhubinu/studyhubserver/exception/apply/StudyApplyLockAcquisitionException.java b/src/main/java/kr/co/studyhubinu/studyhubserver/exception/apply/LockAcquisitionException.java similarity index 82% rename from src/main/java/kr/co/studyhubinu/studyhubserver/exception/apply/StudyApplyLockAcquisitionException.java rename to src/main/java/kr/co/studyhubinu/studyhubserver/exception/apply/LockAcquisitionException.java index d53020e..010cd6c 100644 --- a/src/main/java/kr/co/studyhubinu/studyhubserver/exception/apply/StudyApplyLockAcquisitionException.java +++ b/src/main/java/kr/co/studyhubinu/studyhubserver/exception/apply/LockAcquisitionException.java @@ -3,12 +3,12 @@ import kr.co.studyhubinu.studyhubserver.exception.StatusType; import kr.co.studyhubinu.studyhubserver.exception.common.CustomException; -public class StudyApplyLockAcquisitionException extends CustomException { +public class LockAcquisitionException extends CustomException { private final StatusType status; private static final String message = "스터디 지원에 대한 락 획득에 실패했습니다."; - public StudyApplyLockAcquisitionException() { + public LockAcquisitionException() { super(message); this.status = StatusType.STUDY_APPLY_LOCK_ACQUISITION; }