### CI Link

https://gradle-enterprise.elastic.co/s/jm23mm5adnb7k

### Repro line

```
./gradlew ':x-pack:plugin:searchable-snapshots:qa:hdfs:javaRestTest' --tests "org.elasticsearch.xpack.searchablesnapshots.hdfs.HdfsSearchableSnapshotsIT.testClearCache" -Dtests.seed=D7B1B85A4D520CDE -Dtests.locale=es-ES -Dtests.timezone=Atlantic/Azores -Druntime.java=18
```

### Does it reproduce?

No

### Applicable branches

7.17

### Failure history

_No response_

### Failure excerpt
```
org.elasticsearch.xpack.searchablesnapshots.hdfs.HdfsSearchableSnapshotsIT > testClearCache FAILED
    java.lang.AssertionError: 
    Expected: <49736L>
         but: was <49752L>
        at __randomizedtesting.SeedInfo.seed([D7B1B85A4D520CDE:196E8296CFC1439E]:0)
        at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
        at org.junit.Assert.assertThat(Assert.java:956)
        at org.junit.Assert.assertThat(Assert.java:923)
        at org.elasticsearch.xpack.searchablesnapshots.AbstractSearchableSnapshotsRestTestCase.lambda$testClearCache$19(AbstractSearchableSnapshotsRestTestCase.java:365)
        at org.elasticsearch.xpack.searchablesnapshots.AbstractSearchableSnapshotsRestTestCase.runSearchableSnapshotsTest(AbstractSearchableSnapshotsRestTestCase.java:229)
        at org.elasticsearch.xpack.searchablesnapshots.AbstractSearchableSnapshotsRestTestCase.runSearchableSnapshotsTest(AbstractSearchableSnapshotsRestTestCase.java:91)
        at org.elasticsearch.xpack.searchablesnapshots.AbstractSearchableSnapshotsRestTestCase.runSearchableSnapshotsTest(AbstractSearchableSnapshotsRestTestCase.java:87)
        at org.elasticsearch.xpack.searchablesnapshots.AbstractSearchableSnapshotsRestTestCase.testClearCache(AbstractSearchableSnapshotsRestTestCase.java:352)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:577)
        at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1750)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$8.evaluate(RandomizedRunner.java:938)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$9.evaluate(RandomizedRunner.java:974)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:988)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at org.apache.lucene.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:49)
        at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
        at org.apache.lucene.util.TestRuleThreadAndTestName$1.evaluate(TestRuleThreadAndTestName.java:48)
        at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
        at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl.forkTimeoutingTask(ThreadLeakControl.java:817)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl$3.evaluate(ThreadLeakControl.java:468)
        at com.carrotsearch.randomizedtesting.RandomizedRunner.runSingleTest(RandomizedRunner.java:947)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$5.evaluate(RandomizedRunner.java:832)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:883)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:894)
        at org.apache.lucene.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:45)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at org.apache.lucene.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:41)
        at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
        at com.carrotsearch.randomizedtesting.rules.NoShadowingOrOverridesOnMethodsRule$1.evaluate(NoShadowingOrOverridesOnMethodsRule.java:40)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
        at org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
        at org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
        at org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:54)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:368)
        at java.base/java.lang.Thread.run(Thread.java:833)
```        
x-pack/plugin/searchable-snapshots/src/test/java/org/elasticsearch/xpack/searchablesnapshots/AbstractSearchableSnapshotsRestTestCase.java
final Response response = client().performRequest(new Request(HttpGet.METHOD_NAME, "/_nodes/stats/thread_pool"));
            assertThat(response.getStatusLine().getStatusCode(), equalTo(RestStatus.OK.getStatus()));
            final Map<String, Object> nodes = extractValue(responseAsMap(response), "nodes");
            assertThat(nodes, notNullValue());
            for (String node : nodes.keySet()) {
                final Map<String, Object> threadPools = extractValue((Map<String, Object>) nodes.get(node), "thread_pool");
                searchableSnapshotsThreadPools.forEach(threadPoolName -> {
                    final Map<String, Object> threadPoolStats = (Map<String, Object>) threadPools.get(threadPoolName);
                    assertThat(threadPoolStats, notNullValue());
                    final Number active = extractValue(threadPoolStats, "active");
                    assertThat(threadPoolName + " has still active tasks", active.longValue(), equalTo(0L));
                    final Number queue = extractValue(threadPoolStats, "queue");
                    assertThat(threadPoolName + " has still enqueued tasks", queue.longValue(), equalTo(0L));
                });
            }
        }, 30L, TimeUnit.SECONDS);
    }
    @SuppressWarnings("unchecked")
    protected static <T> T extractValue(Map<String, Object> map, String path) {
        return (T) XContentMapValues.extractValue(path, map);
    }
    /**
     * The body of a test case, which runs after the searchable snapshot has been created and restored.
     */
    @FunctionalInterface
    interface SearchableSnapshotsTestCaseBody {
        void runTest(String indexName, int numDocs) throws Exception;
    }
}