Files

File: src/main/java/com/paymentlink/reservation/ReservationCleanupScheduler.java

1 package com.paymentlink.reservation;
2
3 import org.slf4j.Logger;
4 import org.slf4j.LoggerFactory;
5 import org.springframework.scheduling.annotation.Scheduled;
6 import org.springframework.stereotype.Component;
7
8 @Component
9 public class ReservationCleanupScheduler {
10
11 private static final Logger logger = LoggerFactory.getLogger(ReservationCleanupScheduler.class);
12
13 private final ReservationService reservationService;
14
15 public ReservationCleanupScheduler(ReservationService reservationService) {
16 this.reservationService = reservationService;
17 }
18
19 /**
20 * Clean up expired reservations every minute (60000ms)
21 */
22 @Scheduled(fixedRate = 60000)
23 public void cleanupExpiredReservations() {
24 logger.debug("Running reservation cleanup task");
25 reservationService.cleanup();
26 }
27 }
28
29