Class HybridExecutor.Builder

java.lang.Object
cloud.opencode.base.parallel.executor.HybridExecutor.Builder
Enclosing class:
HybridExecutor

public static final class HybridExecutor.Builder extends Object
Builder for HybridExecutor. HybridExecutor 的构建器。

Example | 示例:

HybridExecutor executor = HybridExecutor.builder()
    .cpuPoolSize(8)
    .cpuThreadNamePrefix("compute-")
    .ioThreadNamePrefix("io-")
    .build();
Since:
JDK 25, opencode-base-parallel V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • cpuPoolSize

      public HybridExecutor.Builder cpuPoolSize(int cpuPoolSize)
      Sets the CPU pool size (platform threads). 设置 CPU 池大小(平台线程)。
      Parameters:
      cpuPoolSize - the pool size - 池大小
      Returns:
      this builder - 此构建器
      Throws:
      IllegalArgumentException - if cpuPoolSize is not positive - 如果 cpuPoolSize 非正数
    • cpuThreadNamePrefix

      public HybridExecutor.Builder cpuThreadNamePrefix(String prefix)
      Sets the CPU thread name prefix. 设置 CPU 线程名称前缀。
      Parameters:
      prefix - the name prefix - 名称前缀
      Returns:
      this builder - 此构建器
    • ioThreadNamePrefix

      public HybridExecutor.Builder ioThreadNamePrefix(String prefix)
      Sets the IO thread name prefix. 设置 IO 线程名称前缀。
      Parameters:
      prefix - the name prefix - 名称前缀
      Returns:
      this builder - 此构建器
    • build

      public HybridExecutor build()
      Builds the HybridExecutor. 构建 HybridExecutor。
      Returns:
      the hybrid executor - 混合执行器