@Override
    public void execute(Runnable command) {
        if (shutdown.get()) {
            throw new RejectedExecutionException("Executor[" + name + "] was shut down.");
        }
        if (!taskQ.offer(command)) {
            throw new RejectedExecutionException("Executor[" + name + "] is overloaded!");
        }
        addNewWorkerIfRequired();
    }
@Test
    public void execute() {
        final int taskCount = 10;
        ManagedExecutorService executorService = newManagedExecutorService(1, taskCount);

        final CountDownLatch latch = new CountDownLatch(taskCount);
        for (int i = 0; i < taskCount; i++) {
            executorService.execute(latch::countDown);
        }

        assertOpenEventually(latch);
    }