public class ThreadFactoryBuilder extends Object implements Builder<ThreadFactory>
Constructor and Description |
---|
ThreadFactoryBuilder() |
Modifier and Type | Method and Description |
---|---|
ThreadFactory |
build()
|
static ThreadFactoryBuilder |
create()
创建
ThreadFactoryBuilder |
ThreadFactoryBuilder |
setDaemon(boolean daemon)
设置是否守护线程
|
ThreadFactoryBuilder |
setNamePrefix(String namePrefix)
设置线程名前缀,例如设置前缀为hutool-thread-,则线程名为hutool-thread-1之类。
|
ThreadFactoryBuilder |
setPriority(int priority)
设置线程优先级
|
ThreadFactoryBuilder |
setThreadFactory(ThreadFactory backingThreadFactory)
设置用于创建基础线程的线程工厂
|
ThreadFactoryBuilder |
setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
设置未捕获异常的处理方式
|
public static ThreadFactoryBuilder create()
ThreadFactoryBuilder
ThreadFactoryBuilder
public ThreadFactoryBuilder setThreadFactory(ThreadFactory backingThreadFactory)
backingThreadFactory
- 用于创建基础线程的线程工厂public ThreadFactoryBuilder setNamePrefix(String namePrefix)
namePrefix
- 线程名前缀public ThreadFactoryBuilder setDaemon(boolean daemon)
daemon
- 是否守护线程public ThreadFactoryBuilder setPriority(int priority)
priority
- 优先级Thread.MIN_PRIORITY
,
Thread.NORM_PRIORITY
,
Thread.MAX_PRIORITY
public ThreadFactoryBuilder setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler uncaughtExceptionHandler)
uncaughtExceptionHandler
- Thread.UncaughtExceptionHandler
public ThreadFactory build()
build
in interface Builder<ThreadFactory>
ThreadFactory
Copyright © 2024. All rights reserved.