Class RateLimitedExecutor.Builder

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

public static final class RateLimitedExecutor.Builder extends Object
Builder for RateLimitedExecutor. RateLimitedExecutor 的构建器。
Since:
JDK 25, opencode-base-parallel V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • permitsPerSecond

      public RateLimitedExecutor.Builder permitsPerSecond(double permitsPerSecond)
      Sets the permits per second. 设置每秒许可数。
      Parameters:
      permitsPerSecond - the permits per second - 每秒许可数
      Returns:
      this builder - 此构建器
    • burstCapacity

      public RateLimitedExecutor.Builder burstCapacity(long burstCapacity)
      Sets the burst capacity. 设置突发容量。
      Parameters:
      burstCapacity - the burst capacity - 突发容量
      Returns:
      this builder - 此构建器
    • executor

      public RateLimitedExecutor.Builder executor(ExecutorService executor)
      Sets a custom executor service. 设置自定义执行器服务。
      Parameters:
      executor - the executor - 执行器
      Returns:
      this builder - 此构建器
    • namePrefix

      public RateLimitedExecutor.Builder namePrefix(String namePrefix)
      Sets the thread name prefix (for default virtual thread executor). 设置线程名称前缀(用于默认虚拟线程执行器)。
      Parameters:
      namePrefix - the name prefix - 名称前缀
      Returns:
      this builder - 此构建器
    • build

      public RateLimitedExecutor build()
      Builds the executor. 构建执行器。
      Returns:
      the executor - 执行器