import java.util.concurrent.TimeUnit;

class CustomScheduledThreadPoolMain {
    public static void main(String[] args) throws Exception {
        System.out.println("Wzorzec Dyspozytor, dostarczanie wartości czujników");
        var pool = new CustomScheduledThreadPoolExecutor(2);

        for(int i=0; i < 4; i++){
            pool.scheduleAtFixedRate(new SensorTask("temperatura-"+i), 0, 50, TimeUnit.MILLISECONDS);
        }
        TimeUnit.MILLISECONDS.sleep(200);
        pool.shutdown();
    }
}
