Module org.tquadrat.foundation.base
Class ThreadFactoryBuilderImpl.ThreadFactoryImpl
java.lang.Object
org.tquadrat.foundation.lang.internal.ThreadFactoryBuilderImpl.ThreadFactoryImpl
- All Implemented Interfaces:
ThreadFactory
- Enclosing class:
ThreadFactoryBuilderImpl
@ClassVersion(sourceVersion="$Id: ThreadFactoryBuilderImpl.java 1143 2024-08-10 18:53:55Z tquadrat $")
@API(status=INTERNAL,
since="0.1.0")
private static final class ThreadFactoryBuilderImpl.ThreadFactoryImpl
extends Object
implements ThreadFactory
The implementation of
ThreadFactory
that is returned by
ThreadFactoryBuilder.build().- Author:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: ThreadFactoryBuilderImpl.java 1143 2024-08-10 18:53:55Z tquadrat $
- Since:
- 0.1.0
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.lang.internal.ThreadFactoryBuilderImpl.ThreadFactoryImpl"
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Thread.BuilderThe thread builder.private final ClassLoaderThe contextClassLoaderfor the new threads.private final AtomicIntegerThe counter for the thread name.private final IntFunction<String> The factory method for the thread names. -
Constructor Summary
ConstructorsConstructorDescriptionThreadFactoryImpl(IntFunction<String> nameFactory, ThreadGroup threadGroup, long stackSize, boolean inheritThreadLocals, ClassLoader contextClassLoader, boolean isDaemon, int priority, Thread.UncaughtExceptionHandler uncaughtExceptionHandler, boolean isVirtual) Creates a new instance ofThreadFactoryImpl. -
Method Summary
-
Field Details
-
m_Builder
The thread builder. -
m_ContextClassLoader
The contextClassLoaderfor the new threads. Can benull. -
m_NameCounter
The counter for the thread name. -
m_NameFactory
The factory method for the thread names.
-
-
Constructor Details
-
ThreadFactoryImpl
public ThreadFactoryImpl(IntFunction<String> nameFactory, ThreadGroup threadGroup, long stackSize, boolean inheritThreadLocals, ClassLoader contextClassLoader, boolean isDaemon, int priority, Thread.UncaughtExceptionHandler uncaughtExceptionHandler, boolean isVirtual) Creates a new instance ofThreadFactoryImpl.- Parameters:
nameFactory- The factory method for the thread names.threadGroup- The thread group for the new thread; can benull.stackSize- The desired stack size for the new threads, or zero to indicate that this parameter is to be ignored.inheritThreadLocals- Iftrue, inherit initial values for inheritable thread-locals from the constructing thread, otherwise no initial values are inherited.contextClassLoader- The context class loader for the new threads; can benull.isDaemon-trueif the new threads are daemon threads,falseotherwise.priority- The priority for the new threads. A value of -1 indicates that no priority will be set explicitly.uncaughtExceptionHandler- The handler for uncaught exceptions for the new threads; can benull.isVirtual-trueif this factory creates virtual threads,falseif it creates platform threads.
-
-
Method Details
-
generateName
Returns the name for the new thread.- Returns:
- The new thread's name.
-
newThread
- Specified by:
newThreadin interfaceThreadFactory
-
