### CI Link

https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+8.7+periodic+java-matrix/ES_RUNTIME_JAVA=openjdk20,GRADLE_TASK=checkPart1,nodes=general-purpose/4/

### Repro line

`./gradlew ':server:internalClusterTest' --tests "org.elasticsearch.discovery.StableMasterDisruptionIT.testStaleMasterNotHijackingMajority" -Dtests.seed=5D665FEF0E31DE1C -Dtests.locale=nb -Dtests.timezone=Pacific/Kosrae -Druntime.java=20`

### Does it reproduce?

Didn't try

### Applicable branches

main

### Failure history

_No response_

### Failure excerpt

```
REPRODUCE WITH: ./gradlew ':server:internalClusterTest' --tests "org.elasticsearch.discovery.StableMasterDisruptionIT.testStaleMasterNotHijackingMajority" -Dtests.seed=5D665FEF0E31DE1C -Dtests.locale=nb -Dtests.timezone=Pacific/Kosrae -Druntime.java=20

org.elasticsearch.discovery.StableMasterDisruptionIT > testStaleMasterNotHijackingMajority FAILED
    java.lang.UnsupportedOperationException
        at java.base/java.lang.Thread.resume(Thread.java:1882)
        at org.elasticsearch.test.disruption.LongGCDisruption.resumeThreads(LongGCDisruption.java:346)
        at org.elasticsearch.test.disruption.LongGCDisruption.startDisrupting(LongGCDisruption.java:178)
        at org.elasticsearch.discovery.StableMasterDisruptionIT.testStaleMasterNotHijackingMajority(StableMasterDisruptionIT.java:278)

    java.lang.UnsupportedOperationException
        at java.base/java.lang.Thread.resume(Thread.java:1882)
        at org.elasticsearch.test.disruption.LongGCDisruption.resumeThreads(LongGCDisruption.java:346)
        at org.elasticsearch.test.disruption.LongGCDisruption.stopDisrupting(LongGCDisruption.java:199)
        at org.elasticsearch.test.disruption.SingleNodeDisruption.removeFromNode(SingleNodeDisruption.java:59)
        at org.elasticsearch.test.disruption.SingleNodeDisruption.removeFromCluster(SingleNodeDisruption.java:42)
        at org.elasticsearch.test.disruption.LongGCDisruption.removeAndEnsureHealthy(LongGCDisruption.java:218)
        at org.elasticsearch.test.InternalTestCluster.clearDisruptionScheme(InternalTestCluster.java:2261)
        at org.elasticsearch.test.InternalTestCluster.clearDisruptionScheme(InternalTestCluster.java:2252)
        at org.elasticsearch.test.ESIntegTestCase.afterInternal(ESIntegTestCase.java:562)
        at org.elasticsearch.test.ESIntegTestCase.cleanUpCluster(ESIntegTestCase.java:2249)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:578)
        at com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1758)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$10.evaluate(RandomizedRunner.java:1004)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at org.apache.lucene.tests.util.TestRuleSetupTeardownChained$1.evaluate(TestRuleSetupTeardownChained.java:48)
        at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
        at org.apache.lucene.tests.util.TestRuleThreadAndTestName$1.evaluate(TestRuleThreadAndTestName.java:45)
        at org.apache.lucene.tests.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:60)
        at org.apache.lucene.tests.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:44)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:390)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl.forkTimeoutingTask(ThreadLeakControl.java:843)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl$3.evaluate(ThreadLeakControl.java:490)
        at com.carrotsearch.randomizedtesting.RandomizedRunner.runSingleTest(RandomizedRunner.java:955)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$5.evaluate(RandomizedRunner.java:840)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$6.evaluate(RandomizedRunner.java:891)
        at com.carrotsearch.randomizedtesting.RandomizedRunner$7.evaluate(RandomizedRunner.java:902)
        at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at org.apache.lucene.tests.util.TestRuleStoreClassName$1.evaluate(TestRuleStoreClassName.java:38)
        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.tests.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
        at org.apache.lucene.tests.util.AbstractBeforeAfterRule$1.evaluate(AbstractBeforeAfterRule.java:43)
        at org.apache.lucene.tests.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:44)
        at org.apache.lucene.tests.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:60)
        at org.apache.lucene.tests.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:47)
        at com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:390)
        at com.carrotsearch.randomizedtesting.ThreadLeakControl.lambda$forkTimeoutingTask$0(ThreadLeakControl.java:850)
        at java.base/java.lang.Thread.run(Thread.java:1623)
```
server/src/internalClusterTest/java/org/elasticsearch/discovery/StableMasterDisruptionIT.java
for (int i = 0; i < 2; i++) {
            
            final String oldMasterNode = internalCluster().getMasterName();
            
            SingleNodeDisruption masterNodeDisruption = new LongGCDisruption(random(), oldMasterNode);
            
            final List<String> majoritySide = new ArrayList<>(nodes);
            majoritySide.remove(oldMasterNode);
            
            final Map<String, List<Tuple<String, String>>> masters = Collections.synchronizedMap(new HashMap<>());
            for (final String node : majoritySide) {
                masters.put(node, new ArrayList<>());
                internalCluster().getInstance(ClusterService.class, node).addListener(event -> {
                    DiscoveryNode previousMaster = event.previousState().nodes().getMasterNode();
                    DiscoveryNode currentMaster = event.state().nodes().getMasterNode();
                    if (Objects.equals(previousMaster, currentMaster) == false) {
                        logger.info(
                            "--> node {} received new cluster state: {} \n and had previous cluster state: {}",
                            node,
                            event.state(),
                            event.previousState()
                        );
                        String previousMasterNodeName = previousMaster != null ? previousMaster.getName() : null;
                        String currentMasterNodeName = currentMaster != null ? currentMaster.getName() : null;
                        masters.get(node).add(new Tuple<>(previousMasterNodeName, currentMasterNodeName));
                    }
                });
            }
            final CountDownLatch oldMasterNodeSteppedDown = new CountDownLatch(1);
            internalCluster().getInstance(ClusterService.class, oldMasterNode).addListener(event -> {