Skip to content

Commit 598e096

Browse files
committed
Fix compilation in JVMErgonomicsTests
This issue arose after a cherry-pick from the wrong branch. Sorry. This commit addresses the issue.
1 parent f3bcc4f commit 598e096

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

distribution/tools/launchers/src/test/java/org/elasticsearch/tools/launchers/JvmErgonomicsTests.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ public void testPooledMemoryChoiceOnNotSmallHeap() throws InterruptedException,
135135
}
136136

137137
public void testMaxDirectMemorySizeChoice() throws InterruptedException, IOException {
138-
final Map<String, String> heapMaxDirectMemorySize = Map.of(
139-
"64M", Long.toString((64L << 20) / 2),
140-
"512M", Long.toString((512L << 20) / 2),
141-
"1024M", Long.toString((1024L << 20) / 2),
142-
"1G", Long.toString((1L << 30) / 2),
143-
"2048M", Long.toString((2048L << 20) / 2),
144-
"2G", Long.toString((2L << 30) / 2),
145-
"8G", Long.toString((8L << 30) / 2));
146-
final String heapSize = randomFrom(heapMaxDirectMemorySize.keySet().toArray(String[]::new));
138+
final Map<String, String> heapMaxDirectMemorySize = new HashMap<>();
139+
heapMaxDirectMemorySize.put("64M", Long.toString((64L << 20) / 2));
140+
heapMaxDirectMemorySize.put("512M", Long.toString((512L << 20) / 2));
141+
heapMaxDirectMemorySize.put("1024M", Long.toString((1024L << 20) / 2));
142+
heapMaxDirectMemorySize.put("1G", Long.toString((1L << 30) / 2));
143+
heapMaxDirectMemorySize.put("2048M", Long.toString((2048L << 20) / 2));
144+
heapMaxDirectMemorySize.put("2G", Long.toString((2L << 30) / 2));
145+
heapMaxDirectMemorySize.put("8G", Long.toString((8L << 30) / 2));
146+
final String heapSize = randomFrom(heapMaxDirectMemorySize.keySet().toArray(new String[0]));
147147
assertThat(
148148
JvmErgonomics.choose(Arrays.asList("-Xms" + heapSize, "-Xmx" + heapSize)),
149149
hasItem("-XX:MaxDirectMemorySize=" + heapMaxDirectMemorySize.get(heapSize)));

0 commit comments

Comments
 (0)