All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.intelie.pipes.time.TimeQueue Maven / Gradle / Ivy

There is a newer version: 0.25.5
Show newest version
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();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy