Class TaskNodeProperties.Builder

java.lang.Object
org.jtrim2.taskgraph.TaskNodeProperties.Builder
Enclosing class:
TaskNodeProperties

public static class TaskNodeProperties.Builder extends Object
The Builder used to create TaskNodeProperties instances.

Thread safety

The methods of this class may not be used from multiple threads concurrently.

Synchronization transparency

The methods of this class are synchronization transparent.
  • Constructor Details

    • Builder

      public Builder()
      Initializes the Builder with the default values:
      • executor: An executor synchronously executing tasks on the calling thread.
    • Builder

      public Builder(TaskNodeProperties defaults)
      Initializes the Builder with the values of the given TaskNodeProperties. Immediately creating a TaskNodeProperties from this Builder will yield an effectively equivalent TaskFactoryProperties as the argument.
      Parameters:
      defaults - the default values used to initialize the Builder. This argument cannot be null.
  • Method Details

    • setDependencyErrorHandler

      public void setDependencyErrorHandler(DependencyErrorHandler dependencyErrorHandler)
      Sets an error handler to be called if the associated node could not be executed due to a dependency error. The handler is called in the same context as the computation of the task node would have been.

      Setting this property will override any previously set value for this property.

      Parameters:
      dependencyErrorHandler - the error handler to be called if the associated node could not be executed due to a dependency error. This argument can be null if there is nothing to do in case of a dependency error.
    • setExecutor

      public final void setExecutor(TaskExecutor executor)
      Sets the executor used to execute the actions of the task nodes. Setting the executor will override any previously set value.
      Parameters:
      executor - the executor used to execute the actions of the task nodes. This argument cannot be null.
    • build

      public TaskNodeProperties build()
      Creates a snapshot of the current state of this Builder. Further adjustment of this Builder will not affect the returned TaskNodeProperties.
      Returns:
      a snapshot of the current state of this Builder. This method may never return null.