Thread.Builder
Thread.Builder
public static sealed interface Thread.Builder.OfVirtual extends Thread.Builder
Thread
or ThreadFactory
that creates virtual threads. Unless otherwise specified, passing a null argument to a method in this interface causes a NullPointerException
to be thrown.
Thread.Builder.OfPlatform, Thread.Builder.OfVirtual
Modifier and Type | Method | Description |
---|---|---|
Thread.Builder.OfVirtual |
inheritInheritableThreadLocals |
Sets whether the thread inherits the initial values of inheritable-thread-local variables from the constructing thread. |
Thread.Builder.OfVirtual |
name |
Sets the thread name. |
Thread.Builder.OfVirtual |
name |
Sets the thread name to be the concatenation of a string prefix and the string representation of a counter value. |
Thread.Builder.OfVirtual |
uncaughtExceptionHandler |
Sets the uncaught exception handler. |
factory, start, unstarted
Thread.Builder.OfVirtual name(String name)
Thread.Builder
name
in interface Thread.Builder
name
- thread nameThread.Builder.OfVirtual name(String prefix, long start)
Thread.Builder
start
. It is incremented after a Thread
is created with this builder so that the next thread is named with the new counter value. A ThreadFactory
created with this builder is seeded with the current value of the counter. The
ThreadFactory
increments its copy of the counter after newThread
is used to create a Thread
.name
in interface Thread.Builder
prefix
- thread name prefixstart
- the starting value of the counterIllegalArgumentException
- if start is negativeThread.Builder.OfVirtual inheritInheritableThreadLocals(boolean inherit)
Thread.Builder
inheritInheritableThreadLocals
in interface Thread.Builder
inherit
- true
to inherit, false
to not inheritThread.Builder.OfVirtual uncaughtExceptionHandler(Thread.UncaughtExceptionHandler ueh)
Thread.Builder
uncaughtExceptionHandler
in interface Thread.Builder
ueh
- uncaught exception handler
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/Thread.Builder.OfVirtual.html