**Build scan:**
https://gradle-enterprise.elastic.co/s/ud4ggnomaa7p6/tests/:x-pack:plugin:ml:test/org.elasticsearch.xpack.ml.job.process.ProcessWorkerExecutorServiceTests/testAutodetectWorkerExecutorServiceDoesNotSwallowErrors
**Reproduction line:**
```
./gradlew ':x-pack:plugin:ml:test' --tests "org.elasticsearch.xpack.ml.job.process.ProcessWorkerExecutorServiceTests.testAutodetectWorkerExecutorServiceDoesNotSwallowErrors" -Dtests.seed=FCF6267296BD3EED -Dtests.locale=pl -Dtests.timezone=CST6CDT -Druntime.java=21
```

**Applicable branches:**
main

**Reproduces locally?:**
Yes

**Failure history:**
https://gradle-enterprise.elastic.co/scans/tests?tests.container=org.elasticsearch.xpack.ml.job.process.ProcessWorkerExecutorServiceTests&tests.test=testAutodetectWorkerExecutorServiceDoesNotSwallowErrors
**Failure excerpt:**
```
java.lang.Exception: Test abandoned because suite timeout was reached.

  at __randomizedtesting.SeedInfo.seed([FCF6267296BD3EED]:0)

```
x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/AbstractProcessWorkerExecutorService.java
) {
        this.contextHolder = Objects.requireNonNull(contextHolder);
        this.processName = Objects.requireNonNull(processName);
        this.queue = queueSupplier.apply(queueCapacity);
    }
    public int queueSize() {
        return queue.size();
    }
    public void shutdownNowWithError(Exception e) {
        error.set(e);
        shutdownNow();
    }
    @Override
    public void shutdown() {
        shouldShutdownAfterCompletingWork.set(true);
    }
    /**
     * Some of the tasks in the returned list of {@link Runnable}s could have run. Some tasks may have run while the queue was being copied.
     *
     * @return a list of tasks that may not have been run
     */
    @Override
    public List<Runnable> shutdownNow() {
        running.set(false);
        return new ArrayList<>(queue);
    }
    @Override
    public boolean isShutdown() {
        return running.get() == false || shouldShutdownAfterCompletingWork.get();
    }