Thread.Builder
Thread.Builder
public static sealed interface Thread.Builder.OfPlatform extends Thread.Builder
Thread
or ThreadFactory
that creates platform 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 |
---|---|---|
default Thread.Builder.OfPlatform |
daemon() |
Sets the daemon status to true . |
Thread.Builder.OfPlatform |
daemon |
Sets the daemon status. |
Thread.Builder.OfPlatform |
group |
Sets the thread group. |
Thread.Builder.OfPlatform |
inheritInheritableThreadLocals |
Sets whether the thread inherits the initial values of inheritable-thread-local variables from the constructing thread. |
Thread.Builder.OfPlatform |
name |
Sets the thread name. |
Thread.Builder.OfPlatform |
name |
Sets the thread name to be the concatenation of a string prefix and the string representation of a counter value. |
Thread.Builder.OfPlatform |
priority |
Sets the thread priority. |
Thread.Builder.OfPlatform |
stackSize |
Sets the desired stack size. |
Thread.Builder.OfPlatform |
uncaughtExceptionHandler |
Sets the uncaught exception handler. |
factory, start, unstarted
Thread.Builder.OfPlatform name(String name)
Thread.Builder
name
in interface Thread.Builder
name
- thread nameThread.Builder.OfPlatform 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.OfPlatform inheritInheritableThreadLocals(boolean inherit)
Thread.Builder
inheritInheritableThreadLocals
in interface Thread.Builder
inherit
- true
to inherit, false
to not inheritThread.Builder.OfPlatform uncaughtExceptionHandler(Thread.UncaughtExceptionHandler ueh)
Thread.Builder
uncaughtExceptionHandler
in interface Thread.Builder
ueh
- uncaught exception handlerThread.Builder.OfPlatform group(ThreadGroup group)
group
- the thread groupThread.Builder.OfPlatform daemon(boolean on)
on
- true
to create daemon threadsdefault Thread.Builder.OfPlatform daemon()
true
.true
.Thread.Builder.OfPlatform priority(int priority)
priority
- priorityIllegalArgumentException
- if the priority is less than Thread.MIN_PRIORITY
or greater than Thread.MAX_PRIORITY
Thread.Builder.OfPlatform stackSize(long stackSize)
The stack size is the approximate number of bytes of address space that the Java virtual machine is to allocate for the thread's stack. The effect is highly platform dependent and the Java virtual machine is free to treat the stackSize
parameter as a "suggestion". If the value is unreasonably low for the platform then a platform specific minimum may be used. If the value is unreasonably high then a platform specific maximum may be used. A value of zero is always ignored.
stackSize
- the desired stack sizeIllegalArgumentException
- if the stack size is negative
© 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.OfPlatform.html