Class ExecutorConfig

java.lang.Object
cloud.opencode.base.parallel.executor.ExecutorConfig

public final class ExecutorConfig extends Object
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:
  • Method Details

    • defaults

      public static ExecutorConfig defaults()
      Creates a default configuration. 创建默认配置。
      Returns:
      the default config - 默认配置
    • builder

      public static ExecutorConfig.Builder builder()
      Creates a new builder. 创建新的构建器。
      Returns:
      the builder - 构建器
    • getNamePrefix

      public String getNamePrefix()
      Gets the thread name prefix. 获取线程名称前缀。
      Returns:
      the name prefix - 名称前缀
    • getMaxConcurrency

      public int getMaxConcurrency()
      Gets the maximum concurrency. 获取最大并发数。
      Returns:
      the max concurrency - 最大并发数
    • getTaskTimeout

      public Duration 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

      public Thread.UncaughtExceptionHandler getUncaughtExceptionHandler()
      Gets the uncaught exception handler. 获取未捕获异常处理器。
      Returns:
      the handler or null - 处理器或 null