Skip to content

Commit

Permalink
refactor: OptimisticLockException을 OptimisticLockingFailureException으… (
Browse files Browse the repository at this point in the history
  • Loading branch information
mirageoasis authored Aug 29, 2024
2 parents ccf6681 + 3777578 commit 5b2d6c3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
demo/** linguist-documentation=false
demo/** linguist-vendored=false
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import jakarta.persistence.LockTimeoutException;

import org.hibernate.PessimisticLockException;
import org.springframework.dao.PessimisticLockingFailureException;

import com.thirdparty.ticketing.domain.common.ErrorCode;
import com.thirdparty.ticketing.domain.common.TicketingException;
Expand All @@ -22,7 +22,7 @@ public class PessimisticReservationServiceProxy implements ReservationServicePro
public void selectSeat(String memberEmail, SeatSelectionRequest seatSelectionRequest) {
try {
reservationTransactionService.selectSeat(memberEmail, seatSelectionRequest);
} catch (PessimisticLockException | LockTimeoutException e) {
} catch (PessimisticLockingFailureException | LockTimeoutException e) {
log.error(e.getMessage(), e);
throw new TicketingException(ErrorCode.NOT_SELECTABLE_SEAT);
}
Expand All @@ -32,7 +32,7 @@ public void selectSeat(String memberEmail, SeatSelectionRequest seatSelectionReq
public void reservationTicket(String memberEmail, TicketPaymentRequest ticketPaymentRequest) {
try {
reservationTransactionService.reservationTicket(memberEmail, ticketPaymentRequest);
} catch (PessimisticLockException | LockTimeoutException e) {
} catch (PessimisticLockingFailureException | LockTimeoutException e) {
log.error(e.getMessage(), e);
throw new TicketingException(ErrorCode.NOT_SELECTABLE_SEAT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ public ReservationService lettuceReservationServiceProxy(
lettuceRepository, cacheReservationTransactionService);
}

@Primary
@Bean
ReservationService optimisticReservationServiceProxy(
@Qualifier("persistenceOptimisticReservationService")
ReservationTransactionService persistenceOptimisticReservationService) {
return new OptimisticReservationServiceProxy(persistenceOptimisticReservationService);
}

@Primary
@Bean
ReservationService pessimisticReservationServiceProxy(
@Qualifier("persistencePessimisticReservationService")
Expand Down

0 comments on commit 5b2d6c3

Please sign in to comment.