mirror of
https://github.com/Athou/commafeed.git
synced 2026-09-25 05:24:20 +00:00
stop the application between tests to make sure that there are no active transactions when we truncate the tables
This commit is contained in:
@@ -23,8 +23,8 @@ public abstract class ScheduledTask {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
};
|
||||
log.info("registering task {} for execution every {} {}, starting in {} {}", getClass().getSimpleName(), getPeriod(), getTimeUnit(),
|
||||
getInitialDelay(), getTimeUnit());
|
||||
log.debug("registering task {} for execution every {} {}, starting in {} {}", getClass().getSimpleName(), getPeriod(),
|
||||
getTimeUnit(), getInitialDelay(), getTimeUnit());
|
||||
executor.scheduleWithFixedDelay(runnable, getInitialDelay(), getPeriod(), getTimeUnit());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,16 +18,17 @@ public class TaskScheduler {
|
||||
|
||||
private final List<ScheduledTask> tasks;
|
||||
private final CommaFeedConfiguration config;
|
||||
private final ScheduledExecutorService executor;
|
||||
|
||||
private ScheduledExecutorService executor;
|
||||
|
||||
public TaskScheduler(@All List<ScheduledTask> tasks, CommaFeedConfiguration config) {
|
||||
this.tasks = tasks;
|
||||
this.config = config;
|
||||
this.executor = Executors.newScheduledThreadPool(tasks.size());
|
||||
}
|
||||
|
||||
public void start() {
|
||||
tasks.forEach(task -> task.register(executor));
|
||||
this.executor = Executors.newScheduledThreadPool(tasks.size());
|
||||
this.tasks.forEach(task -> task.register(executor));
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
|
||||
Reference in New Issue
Block a user