Class TaskConfig.BuilderBase<BUILDER extends TaskConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends TaskConfig>

java.lang.Object
io.helidon.scheduling.TaskConfig.BuilderBase<BUILDER,PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER,PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Direct Known Subclasses:
CronConfig.BuilderBase, FixedRateConfig.BuilderBase, TaskConfig.Builder
Enclosing interface:
TaskConfig

public abstract static class TaskConfig.BuilderBase<BUILDER extends TaskConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends TaskConfig> extends Object implements ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for TaskConfig.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(TaskConfig prototype)
      Update this builder from an existing prototype instance. This method disables automatic service discovery.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(TaskConfig.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • config

      @Deprecated public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface ConfigBuilderSupport.ConfiguredBuilder<BUILDER extends TaskConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends TaskConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • config

      public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface ConfigBuilderSupport.ConfiguredBuilder<BUILDER extends TaskConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends TaskConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • executor

      public BUILDER executor(ScheduledExecutorService executor)
      Custom ScheduledExecutorService used for executing scheduled task.
      Parameters:
      executor - custom ScheduledExecutorService
      Returns:
      updated builder instance
      See Also:
    • taskManager

      public BUILDER taskManager(TaskManager taskManager)
      Task manager that will manage the created task.
      Parameters:
      taskManager - task manager, by default taken from the global service registry
      Returns:
      updated builder instance
      See Also:
    • clearId

      public BUILDER clearId()
      Clear existing value of id.
      Returns:
      updated builder instance
      See Also:
    • id

      public BUILDER id(String id)
      Identification of the started task. This can be used to later look up the instance, for example to cancel it.
      Parameters:
      id - task id, if not provided via configuration or builder, the configured task will generate a unique ID
      Returns:
      updated builder instance
      See Also:
    • enabled

      public BUILDER enabled(boolean enabled)
      Whether the task is enabled. If disabled, the task will not be scheduled. Default value is true.
      Parameters:
      enabled - true if the task should be scheduled
      Returns:
      updated builder instance
      See Also:
    • taskManagerDiscoverServices

      public BUILDER taskManagerDiscoverServices(boolean taskManagerDiscoverServices)
      Service discovery flag for taskManager(). If set to true, services will be discovered from Java service loader, or Helidon ServiceRegistry.
      Parameters:
      taskManagerDiscoverServices - whether to enable automatic service discovery
      Returns:
      updated builder instance
      See Also:
    • serviceRegistry

      public BUILDER serviceRegistry(ServiceRegistry serviceRegistry)
      Service registry used to discover providers and services. Provide an explicit registry instance to use.

      If not configured, the GlobalServiceRegistry would be used to discover services.

      Parameters:
      serviceRegistry - service registry to use
      Returns:
      updated builder instance
      See Also:
    • executor

      public Optional<ScheduledExecutorService> executor()
      Custom ScheduledExecutorService used for executing scheduled task.
      Returns:
      custom ScheduledExecutorService
    • taskManager

      public Optional<TaskManager> taskManager()
      Task manager that will manage the created task.
      Returns:
      task manager, by default taken from the global service registry
    • id

      public Optional<String> id()
      Identification of the started task. This can be used to later look up the instance, for example to cancel it.
      Returns:
      task id, if not provided via configuration or builder, the configured task will generate a unique ID
    • enabled

      public boolean enabled()
      Whether the task is enabled. If disabled, the task will not be scheduled. Default value is true.
      Returns:
      true if the task should be scheduled
    • taskManagerDiscoverServices

      public boolean taskManagerDiscoverServices()
      Service discovery flag for taskManager(). If set to true, services will be discovered from Java service loader, or Helidon ServiceRegistry.
      Returns:
      whether to enable automatic service discovery
    • serviceRegistry

      public Optional<ServiceRegistry> serviceRegistry()
      Service registry used to discover providers and services. Provide an explicit registry instance to use.

      If not configured, the GlobalServiceRegistry would be used to discover services.

      Returns:
      service registry to use
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.
    • config

      protected Optional<Config> config()
      Configuration used to configure this instance.
      Returns:
      config instance