diff --git a/core/src/test/java/org/elasticsearch/common/util/concurrent/KeyedLockTests.java b/core/src/test/java/org/elasticsearch/common/util/concurrent/KeyedLockTests.java index 4d8fc8d3ecc..fdce390fa05 100644 --- a/core/src/test/java/org/elasticsearch/common/util/concurrent/KeyedLockTests.java +++ b/core/src/test/java/org/elasticsearch/common/util/concurrent/KeyedLockTests.java @@ -116,6 +116,7 @@ public class KeyedLockTests extends ESTestCase { String[] names; ConcurrentHashMap counter; ConcurrentHashMap safeCounter; + final int numRuns = scaledRandomIntBetween(5000, 50000); public AcquireAndReleaseThread(CountDownLatch startLatch, KeyedLock connectionLock, String[] names, ConcurrentHashMap counter, ConcurrentHashMap safeCounter) { @@ -133,7 +134,6 @@ public class KeyedLockTests extends ESTestCase { } catch (InterruptedException e) { throw new RuntimeException(e); } - int numRuns = scaledRandomIntBetween(5000, 50000); for (int i = 0; i < numRuns; i++) { String curName = names[randomInt(names.length - 1)]; assert connectionLock.isHeldByCurrentThread(curName) == false;