Checkpoint: Added performExchange into cron

Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
Marcin Woźniak 2021-01-13 14:42:13 +01:00
parent 986407b8f8
commit 75a3bc46f2
Signed by: y0rune
GPG Key ID: F204C385F57EB348

View File

@ -6,6 +6,7 @@ import java.util.concurrent.ScheduledFuture;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.scheduling.support.CronTrigger; import org.springframework.scheduling.support.CronTrigger;
@ -14,6 +15,9 @@ import org.springframework.stereotype.Service;
@Service @Service
public class EventService { public class EventService {
@Autowired
private ExchangeService exchangeService;
public static final int FIRST_TOUR_SCHEDULE = 0; public static final int FIRST_TOUR_SCHEDULE = 0;
public static final int SECOND_TOUR_SCHEDULE = 1; public static final int SECOND_TOUR_SCHEDULE = 1;
@ -25,9 +29,15 @@ public class EventService {
System.out.println("Checking for groups"); 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 * Schedule provided task to perform
* *
* @param taskId static filed of this class that represents to what event * @param taskId static filed of this class that represents to what event
* we want to assign task * we want to assign task
* @param task runnable class that perform task in implemented run method * @param task runnable class that perform task in implemented run method