Skip to content

Commit

Permalink
[Feat] : lock AOP 예외처리
Browse files Browse the repository at this point in the history
  • Loading branch information
wellbeing-dough committed Jul 22, 2024
1 parent 08ba1a4 commit 303f144
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 303f144

Please sign in to comment.