Top Description Constructors Methods
reactor.core.scheduler

pack-priv Class VirtualThreadFactory

extends Object
implements ThreadFactory, UncaughtExceptionHandler
Class Inheritance
All Implemented Interfaces
java.lang.Thread.UncaughtExceptionHandler, java.util.concurrent.ThreadFactory
Imports
java.util.concurrent.ThreadFactory, java.util.concurrent.atomic.AtomicLong, java.util.function.BiConsumer, .Supplier, reactor.util.annotation.NonNull, .Nullable

The noop VirtualThread Reactor ThreadFactory to be used with ThreadPerTaskBoundedElasticScheduler. It throws exceptions when is being created, so it indicates that current Java Runtime does not support VirtualThreads.
Author
Oleh Dokuka

Constructor Summary

AccessConstructor and Description
pack-priv
VirtualThreadFactory(String name, boolean inheritThreadLocals, BiConsumer<Thread, Throwable> uncaughtExceptionHandler)

Method Summary

Modifier and TypeMethod and Description
public final Thread
newThread(Runnable
a runnable to be executed by new thread instance
runnable
)

Implements java.util.concurrent.ThreadFactory.newThread.

Constructs a new unstarted Thread to run the given runnable.
public void
uncaughtException(Thread
the thread
t
,
Throwable
the exception
e
)

Implements java.lang.Thread.UncaughtExceptionHandler.uncaughtException.

Method invoked when the given thread terminates due to the given uncaught exception.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

VirtualThreadFactoryback to summary
pack-priv VirtualThreadFactory(String name, boolean inheritThreadLocals, BiConsumer<Thread, Throwable> uncaughtExceptionHandler)

Method Detail

newThreadback to summary
public final Thread newThread(Runnable runnable)

Implements java.util.concurrent.ThreadFactory.newThread.

Doc from java.util.concurrent.ThreadFactory.newThread.

Constructs a new unstarted Thread to run the given runnable.

Parameters
runnable:Runnable

a runnable to be executed by new thread instance

Returns:Thread

constructed thread, or null if the request to create a thread is rejected

Annotations
@Override
uncaughtExceptionback to summary
public void uncaughtException(Thread t, Throwable e)

Implements java.lang.Thread.UncaughtExceptionHandler.uncaughtException.

Doc from java.lang.Thread.UncaughtExceptionHandler.uncaughtException.

Method invoked when the given thread terminates due to the given uncaught exception.

Any exception thrown by this method will be ignored by the Java Virtual Machine.

Parameters
t:Thread

the thread

e:Throwable

the exception

Annotations
@Override