Class ThreadPoolSupplier

java.lang.Object
io.helidon.common.configurable.ThreadPoolSupplier
All Implemented Interfaces:
RuntimeType.Api<ThreadPoolConfig>, Supplier<ExecutorService>

public final class ThreadPoolSupplier extends Object implements Supplier<ExecutorService>, RuntimeType.Api<ThreadPoolConfig>
Supplier of a custom thread pool. The returned thread pool supports Context propagation.
  • Method Details

    • builder

      public static ThreadPoolConfig.Builder builder()
      Create a new fluent API builder to build thread pool supplier.
      Returns:
      a builder instance
    • create

      public static ThreadPoolSupplier create(Config config, String name)
      Load supplier from configuration.
      Parameters:
      config - config instance
      name - thread pool name
      Returns:
      a new thread pool supplier configured from config
    • create

      public static ThreadPoolSupplier create(String name)
      Create a new thread pool supplier with default configuration and a given name.
      Parameters:
      name - thread pool name
      Returns:
      a new thread pool supplier with default configuration
    • create

      public static ThreadPoolSupplier create(ThreadPoolConfig config)
      Create a new thread pool supplier based on its configuration.
      Parameters:
      config - configuration
      Returns:
      a new thread pool supplier
    • create

      public static ThreadPoolSupplier create(Consumer<ThreadPoolConfig.Builder> consumer)
      Create a new thread pool supplier customizing its configuration.
      Parameters:
      consumer - configuration consumer
      Returns:
      a new thread pool supplier
    • prototype

      public ThreadPoolConfig prototype()
      Description copied from interface: RuntimeType.Api
      The prototype as it was received when creating this runtime object instance.
      Specified by:
      prototype in interface RuntimeType.Api<ThreadPoolConfig>
      Returns:
      prototype object used to create this instance
    • get

      public ExecutorService get()
      Specified by:
      get in interface Supplier<ExecutorService>
    • corePoolSize

      public int corePoolSize()
      Returns size of core pool.
      Returns:
      size of core pool.