Skip to content

Commit

Permalink
Enforce intial value read
Browse files Browse the repository at this point in the history
  • Loading branch information
ingvord committed May 21, 2021
1 parent 7ca1d2f commit 0526ba9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/wpn/hdri/ss/engine2/Engine.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -49,9 +50,12 @@ public Engine(ScheduledExecutorService exec, DataStorage storage,
private void start(boolean append, long delay){
for(Attribute attr : polledAttributes){
logger.debug("Scheduling polling task for {}", attr.fullName);
PollTask task = new PollTask(attr, storage, append);
runningTasks.put(attr.fullName,
exec.scheduleWithFixedDelay(
new PollTask(attr, storage, append), 0L, delay == -1 ? attr.delay : delay, TimeUnit.MILLISECONDS));
task, 0L, delay == -1 ? attr.delay : delay, TimeUnit.MILLISECONDS));

CompletableFuture.runAsync(task);
}
for (Attribute attr : eventDrivenAttributes) {
logger.debug("Subscribing to {}", attr.fullName);
Expand Down

0 comments on commit 0526ba9

Please sign in to comment.