Skip to content

Commit f1af789

Browse files
committed
Disable use of virtual threads
1 parent 2a6d2eb commit f1af789

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/com/rabbitmq/stream/impl/ThreadUtils.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,18 @@ final class ThreadUtils {
2828

2929
private static final Logger LOGGER = LoggerFactory.getLogger(ThreadUtils.class);
3030

31+
static final boolean VIRTUAL_THREADS_ON =
32+
Boolean.parseBoolean(System.getProperty("rabbitmq.stream.threads.virtual.enabled", "false"));
33+
3134
private static final ThreadFactory THREAD_FACTORY;
3235
private static final Predicate<Thread> IS_VIRTUAL;
3336

3437
static {
3538
ThreadFactory tf;
36-
if (isJava21OrMore()) {
37-
LOGGER.debug("Running Java 21 or more, using virtual threads");
39+
LOGGER.debug("Virtual threads enabled: {}", VIRTUAL_THREADS_ON);
40+
LOGGER.debug("Java 21 or more: {}", isJava21OrMore());
41+
if (VIRTUAL_THREADS_ON && isJava21OrMore()) {
42+
LOGGER.debug("Using virtual threads");
3843
try {
3944
Class<?> builderClass =
4045
Arrays.stream(Thread.class.getDeclaredClasses())

0 commit comments

Comments
 (0)