Package org.jtrim2.taskgraph
Class TaskNodeProperties.Builder
java.lang.Object
org.jtrim2.taskgraph.TaskNodeProperties.Builder
- Enclosing class:
- TaskNodeProperties
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 Summary
ConstructorDescriptionBuilder()
Initializes theBuilder
with the default values: executor: An executor synchronously executing tasks on the calling thread.Builder
(TaskNodeProperties defaults) Initializes theBuilder
with the values of the givenTaskNodeProperties
. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates a snapshot of the current state of thisBuilder
.void
setDependencyErrorHandler
(DependencyErrorHandler dependencyErrorHandler) Sets an error handler to be called if the associated node could not be executed due to a dependency error.final void
setExecutor
(TaskExecutor executor) Sets the executor used to execute the actions of the task nodes.
-
Constructor Details
-
Builder
public Builder()Initializes theBuilder
with the default values:- executor: An executor synchronously executing tasks on the calling thread.
-
Builder
Initializes theBuilder
with the values of the givenTaskNodeProperties
. Immediately creating aTaskNodeProperties
from thisBuilder
will yield an effectively equivalentTaskFactoryProperties
as the argument.- Parameters:
defaults
- the default values used to initialize theBuilder
. This argument cannot benull
.
-
-
Method Details
-
setDependencyErrorHandler
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 benull
if there is nothing to do in case of a dependency error.
-
setExecutor
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 benull
.
-
build
Creates a snapshot of the current state of thisBuilder
. Further adjustment of thisBuilder
will not affect the returnedTaskNodeProperties
.- Returns:
- a snapshot of the current state of this
Builder
. This method may never returnnull
.
-