Interface ThreadPoolConfig

All Superinterfaces:
Prototype.Api, Prototype.Factory<ThreadPoolSupplier>
All Known Implementing Classes:
ThreadPoolConfig.BuilderBase.ThreadPoolConfigImpl

public interface ThreadPoolConfig extends Prototype.Api
Interface generated from definition. Please add javadoc to the definition interface.
See Also:
  • Field Details

  • Method Details

    • builder

      static ThreadPoolConfig.Builder builder()
      Create a new fluent API builder to customize configuration.
      Returns:
      a new builder
    • builder

      static ThreadPoolConfig.Builder builder(ThreadPoolConfig instance)
      Create a new fluent API builder from an existing instance.
      Parameters:
      instance - an existing instance used as a base for the builder
      Returns:
      a builder based on an instance
    • create

      static ThreadPoolConfig create(Config config)
      Create a new instance from configuration.
      Parameters:
      config - used to configure the new instance
      Returns:
      a new instance configured from configuration
    • create

      static ThreadPoolConfig create()
      Create a new instance with default values.
      Returns:
      a new instance
    • virtualThreads

      boolean virtualThreads()
      When configured to true, an unbounded virtual executor service (project Loom) will be used.

      If enabled, all other configuration options of this executor service are ignored!

      Returns:
      whether to use virtual threads or not, defaults to false
    • corePoolSize

      int corePoolSize()
      Core pool size of the thread pool executor. Defaults to 10.
      Returns:
      corePoolSize see ThreadPoolExecutor.getCorePoolSize()
    • maxPoolSize

      int maxPoolSize()
      Max pool size of the thread pool executor. Defaults to 50.
      Returns:
      maxPoolSize see ThreadPoolExecutor.getMaximumPoolSize()
    • keepAlive

      Duration keepAlive()
      Keep alive of the thread pool executor. Defaults to "PT3M".
      Returns:
      keep alive see ThreadPoolExecutor.getKeepAliveTime(java.util.concurrent.TimeUnit)
    • queueCapacity

      int queueCapacity()
      Queue capacity of the thread pool executor. Defaults to 10000.
      Returns:
      capacity of the queue backing the executor
    • daemon

      boolean daemon()
      Is daemon of the thread pool executor. Defaults to true.
      Returns:
      whether the threads are daemon threads
    • name

      Optional<String> name()
      Name of this thread pool executor.
      Returns:
      the pool name
    • growthThreshold

      int growthThreshold()
      The queue size above which pool growth will be considered if the pool is not fixed size. Defaults to 1000.
      Returns:
      the growth threshold
    • growthRate

      int growthRate()
      The percentage of task submissions that should result in adding threads, expressed as a value from 1 to 100. The rate applies only when all of the following are true:
      • the pool size is below the maximum, and
      • there are no idle threads, and
      • the number of tasks in the queue exceeds the growthThreshold
      For example, a rate of 20 means that while these conditions are met one thread will be added for every 5 submitted tasks.

      Defaults to 0

      Returns:
      the growth rate
    • rejectionHandler

      ThreadPool.RejectionHandler rejectionHandler()
      Rejection policy of the thread pool executor.
      Returns:
      the rejection handler
    • threadNamePrefix

      Optional<String> threadNamePrefix()
      Name prefix for threads in this thread pool executor. Defaults to "helidon-".
      Returns:
      prefix of a thread name
    • shouldPrestart

      boolean shouldPrestart()
      Whether to prestart core threads in this thread pool executor. Defaults to true.
      Returns:
      whether to prestart the threads