Skip to content

Commit 53de7ff

Browse files
committed
Undo other hacks
1 parent c927899 commit 53de7ff

File tree

2 files changed

+0
-15
lines changed

2 files changed

+0
-15
lines changed

server/src/main/java/org/elasticsearch/common/Randomness.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,7 @@ public static Random get(Settings settings, Setting<Long> setting) {
8787
* RandomizedContext or tests are
8888
* running but tests.seed is not set
8989
*/
90-
@SuppressForbidden(reason = "Need to hack something for virtual threads")
9190
public static Random get() {
92-
if (Thread.currentThread().isVirtual()) {
93-
// Need to work out how to propagate context to virtual threads
94-
return ThreadLocalRandom.current();
95-
}
9691
if (currentMethod != null && getRandomMethod != null) {
9792
try {
9893
Object randomizedContext = currentMethod.invoke(null);

test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@
207207
import java.util.concurrent.Future;
208208
import java.util.concurrent.FutureTask;
209209
import java.util.concurrent.Semaphore;
210-
import java.util.concurrent.ThreadLocalRandom;
211210
import java.util.concurrent.TimeUnit;
212211
import java.util.concurrent.TimeoutException;
213212
import java.util.concurrent.atomic.AtomicInteger;
@@ -1037,15 +1036,6 @@ public static boolean randomBoolean() {
10371036
return random().nextBoolean();
10381037
}
10391038

1040-
public static Random random() {
1041-
// I don't think carrotsearch's random context work with virtual threads at the moment
1042-
if (Thread.currentThread().isVirtual()) {
1043-
return ThreadLocalRandom.current();
1044-
} else {
1045-
return LuceneTestCase.random();
1046-
}
1047-
}
1048-
10491039
public static Boolean randomOptionalBoolean() {
10501040
return randomBoolean() ? Boolean.TRUE : randomFrom(Boolean.FALSE, null);
10511041
}

0 commit comments

Comments
 (0)