Class ExecutorConfig
java.lang.Object
cloud.opencode.base.parallel.executor.ExecutorConfig
Executor Config - Executor Configuration
执行器配置 - 执行器配置
Configuration options for virtual thread executors.
虚拟线程执行器的配置选项。
Example | 示例:
ExecutorConfig config = ExecutorConfig.builder()
.namePrefix("worker-")
.maxConcurrency(100)
.taskTimeout(Duration.ofSeconds(30))
.build();
Features | 主要功能:
- Concurrency limit configuration - 并发限制配置
- Task timeout configuration - 任务超时配置
- Thread naming configuration - 线程命名配置
- Builder pattern - 构建器模式
Security | 安全性:
- Thread-safe: Yes (immutable after construction) - 线程安全: 是(构造后不可变)
- Since:
- JDK 25, opencode-base-parallel V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for ExecutorConfig. -
Method Summary
Modifier and TypeMethodDescriptionstatic ExecutorConfig.Builderbuilder()Creates a new builder.static ExecutorConfigdefaults()Creates a default configuration.intGets the maximum concurrency.Gets the thread name prefix.Gets the task timeout.Gets the uncaught exception handler.booleanChecks if thread locals should be inherited.
-
Method Details
-
defaults
Creates a default configuration. 创建默认配置。- Returns:
- the default config - 默认配置
-
builder
Creates a new builder. 创建新的构建器。- Returns:
- the builder - 构建器
-
getNamePrefix
Gets the thread name prefix. 获取线程名称前缀。- Returns:
- the name prefix - 名称前缀
-
getMaxConcurrency
public int getMaxConcurrency()Gets the maximum concurrency. 获取最大并发数。- Returns:
- the max concurrency - 最大并发数
-
getTaskTimeout
Gets the task timeout. 获取任务超时。- Returns:
- the timeout or null - 超时或 null
-
isInheritThreadLocals
public boolean isInheritThreadLocals()Checks if thread locals should be inherited. 检查是否应继承线程本地变量。- Returns:
- true if inherit - 如果继承返回 true
-
getUncaughtExceptionHandler
Gets the uncaught exception handler. 获取未捕获异常处理器。- Returns:
- the handler or null - 处理器或 null
-