public Executor(ThreadFactory threadFactory, BlockingQueue queue, Executor.Controller controller, int initialThreadCount, EnumSet<Stats.Metric> metrics, long samplePeriod, long controlPeriod, TimeUnit unit) {

        _threadFactory = threadFactory;
        _queue = queue;
        _controller = controller;
        _metrics = metrics;

        _measureQueueLatency = _metrics.contains(Stats.Metric.QUEUE_LATENCY);
        _measureTaskLatency = _metrics.contains(Stats.Metric.TASK_LATENCY);
        _measureTaskArrivalRate = _metrics.contains(Stats.Metric.TASK_ARRIVAL_RATE);
        _measureTaskRejectionRate = _metrics.contains(Stats.Metric.TASK_REJECTION_RATE);

        final int duration = (int) unit.toMillis(samplePeriod);
        final int iterations = (int) (controlPeriod / samplePeriod);

        Thread t =
            new Thread(new Runnable() {
                    public void run() {
                        startControlLoop(duration, iterations);
                    }
                },
                "dirigiste-executor-controller-" + _numExecutors.getAndIncrement());
        t.setDaemon(true);
        t.start();

        for (int i = 0; i < Math.max(1, initialThreadCount); i++) {
            startWorker();
        }
    }