net.intelie.pipes.time.TimeQueue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pipes-api Show documentation
Show all versions of pipes-api Show documentation
Intelie Pipes' API classes and interfaces
package net.intelie.pipes.time;
public class TimeQueue {
private final ManualSchedulerContext scheduler;
public TimeQueue() {
this(null);
}
public TimeQueue(TaskRunner runner) {
this.scheduler = new ManualSchedulerContext(runner);
}
public long notifyEvent() {
return scheduler.notifyEvent();
}
public void addTask(Period period, Task task) {
scheduler.schedule(period, task);
}
public void offer(long timestamp) {
scheduler.start(timestamp);
scheduler.advanceTo(timestamp);
}
public void flush() {
scheduler.start(0);
scheduler.flushAndCancelAll();
}
}