package impl;

import java.util.concurrent.*;

public class Scheduler {
    private final ScheduledExecutorService scheduler;

    public Scheduler(int nbCanaux) {
        int nThread = 2+2*nbCanaux;
        this.scheduler = Executors.newScheduledThreadPool(nThread);
    }

    public ScheduledExecutorService getScheduler(){
        return this.scheduler;
    }

    public <T> Future<T> enquete(Callable<T> task, long delay) {
        return scheduler.schedule(task, delay, TimeUnit.MILLISECONDS);
    }
}
