|
|
@@ -1,6 +1,10 @@
|
|
|
package cz.senslog.watchdog.util.schedule;
|
|
|
|
|
|
|
|
|
+import cz.senslog.watchdog.messagebroker.email.EmailMessageBroker;
|
|
|
+import org.apache.logging.log4j.LogManager;
|
|
|
+import org.apache.logging.log4j.Logger;
|
|
|
+
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
import java.util.concurrent.CountDownLatch;
|
|
|
@@ -12,6 +16,8 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
|
|
|
|
|
public final class ScheduleTask {
|
|
|
|
|
|
+ private static final Logger logger = LogManager.getLogger(EmailMessageBroker.class);
|
|
|
+
|
|
|
private static final int DEFAULT_DELAY_MILLIS = 2_000; // 2s
|
|
|
|
|
|
private TaskDescription description;
|
|
|
@@ -61,7 +67,8 @@ public final class ScheduleTask {
|
|
|
} else if (delayMillis > 0) {
|
|
|
delay = delayMillis;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ logger.info("The task '{}' is going to be executed in {} ms.", description.getName(), delay);
|
|
|
ScheduledFuture<?> future = scheduledService.scheduleAtFixedRate(task, delay, periodMillis, MILLISECONDS);
|
|
|
description = new TaskDescription(description.getName(), Status.RUNNING);
|
|
|
new Thread(() -> {
|