**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/test/java/org/elasticsearch/xpack/ml/job/process/ProcessWorkerExecutorServiceTests.java
ProcessWorkerExecutorService executor = createExecutorService();
        threadPool.generic().execute(executor::start);
        executor.shutdownNow();
        AtomicBoolean rejected = new AtomicBoolean(false);
        AtomicBoolean initialized = new AtomicBoolean(false);
        executor.execute(new AbstractInitializableRunnable() {
            @Override
            public void onRejection(Exception e) {
                assertThat(e, isA(EsRejectedExecutionException.class));
                rejected.set(true);
            }
            @Override
            public void init() {
                initialized.set(true);
            }
            @Override
            public void onFailure(Exception e) {
                fail("onFailure should not be called after the worker is shutdown");
            }
            @Override
            protected void doRun() throws Exception {
                fail("doRun should not be called after the worker is shutdown");
            }
        });
        assertTrue(rejected.get());
        assertTrue(initialized.get());
    }
    public void testAutodetectWorkerExecutorService_TasksNotExecutedCallHandlerOnShutdown() throws Exception {
        ProcessWorkerExecutorService executor = createExecutorService();
        CountDownLatch latch = new CountDownLatch(1);