From 75a3bc46f26fca9c557b4df053cb9dddc2d5f62c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Wed, 13 Jan 2021 14:42:13 +0100 Subject: [PATCH] Checkpoint: Added performExchange into cron MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcin Woźniak --- .../java/com/plannaplan/services/EventService.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/buisnesslogic/src/main/java/com/plannaplan/services/EventService.java b/buisnesslogic/src/main/java/com/plannaplan/services/EventService.java index b70af1b..b6fb6c6 100755 --- a/buisnesslogic/src/main/java/com/plannaplan/services/EventService.java +++ b/buisnesslogic/src/main/java/com/plannaplan/services/EventService.java @@ -6,6 +6,7 @@ import java.util.concurrent.ScheduledFuture; import javax.annotation.PostConstruct; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.scheduling.support.CronTrigger; @@ -14,6 +15,9 @@ import org.springframework.stereotype.Service; @Service public class EventService { + @Autowired + private ExchangeService exchangeService; + public static final int FIRST_TOUR_SCHEDULE = 0; public static final int SECOND_TOUR_SCHEDULE = 1; @@ -25,9 +29,15 @@ public class EventService { System.out.println("Checking for groups"); } + @Scheduled(cron = "0 0 0 * * *") + public void performExchangeService() { + System.out.println("Performing Exchange"); + this.exchangeService.performExchange(); + } + /** * Schedule provided task to perform - * + * * @param taskId static filed of this class that represents to what event * we want to assign task * @param task runnable class that perform task in implemented run method