diff options
Diffstat (limited to 'src/main/java/pl/edu/mimuw/cloudatlas/agent/modules')
3 files changed, 29 insertions, 1 deletions
diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Qurnik.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Qurnik.java index 1ab8a16..2119653 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Qurnik.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Qurnik.java @@ -94,6 +94,8 @@ public class Qurnik extends Module { if (!currentPath.toString().equals("/")) { newAttributes.add("name", new ValueString(currentPath.getSingletonName())); + } else { + newAttributes.add("name", new ValueString(null)); } long currentTime = System.currentTimeMillis(); newAttributes.add("timestamp", new ValueTime(currentTime)); diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/RecursiveScheduledTask.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/RecursiveScheduledTask.java new file mode 100644 index 0000000..07e1fd4 --- /dev/null +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/RecursiveScheduledTask.java @@ -0,0 +1,26 @@ +package pl.edu.mimuw.cloudatlas.agent.modules; + +import java.util.function.Supplier; + +import pl.edu.mimuw.cloudatlas.agent.messages.TimerSchedulerMessage; + +public class RecursiveScheduledTask extends TimerScheduledTask { + private long delay; + private Supplier<TimerScheduledTask> taskSupplier; + + public RecursiveScheduledTask(long delay, Supplier<TimerScheduledTask> taskSupplier) { + this.delay = delay; + this.taskSupplier = taskSupplier; + } + + public void run() { + try { + TimerScheduledTask task = taskSupplier.get(); + task.setScheduler(scheduler); + task.run(); + sendMessage(new TimerSchedulerMessage("", 0, "", delay, 0, new RecursiveScheduledTask(delay, taskSupplier))); + } catch (InterruptedException e) { + System.out.println("Caught interrupted exception while running RecursiveScheduledTask"); + } + } +} diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/TimerScheduledTask.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/TimerScheduledTask.java index 7a0da70..da4bd6f 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/TimerScheduledTask.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/TimerScheduledTask.java @@ -5,7 +5,7 @@ import pl.edu.mimuw.cloudatlas.agent.messages.AgentMessage; import java.util.TimerTask; public abstract class TimerScheduledTask extends TimerTask { - private TimerScheduler scheduler; + protected TimerScheduler scheduler; public abstract void run(); |