Class TaskRunner


  • public class TaskRunner
    extends Object
    This class allow to run a task context.
    Since:
    2.0
    Author:
    Laurent Jourdren
    • Constructor Detail

      • TaskRunner

        public TaskRunner​(TaskContextImpl taskContext)
        Constructor.
        Parameters:
        taskContext - task context to execute
      • TaskRunner

        public TaskRunner​(TaskContextImpl taskContext,
                          StepStatus stepStatus)
        Constructor.
        Parameters:
        taskContext - task context to execute
        stepStatus - step status
    • Method Detail

      • getResult

        public TaskResultImpl getResult()
        Get the context result.
        Returns:
        a TaskResult object
      • setForceStepInstanceReuse

        public void setForceStepInstanceReuse​(boolean reuse)
        Force the TaskRunner to reuse the original step instance when execute the task.
        Parameters:
        reuse - true if the step instance must be reuse when execute the task
      • run

        public TaskResultImpl run()
        Run the task context.
        Returns:
        a task result object
      • createStepResult

        public static TaskResultImpl createStepResult​(TaskContextImpl taskContext,
                                                      Throwable exception)
        Create a step result for an exception.
        Parameters:
        taskContext - task context
        exception - exception
        Returns:
        a new TaskResult object
      • createStepResult

        public static TaskResultImpl createStepResult​(TaskContextImpl taskContext,
                                                      Throwable exception,
                                                      String errorMessage)
        Create a step result for an exception.
        Parameters:
        taskContext - task context
        exception - exception
        errorMessage - error message
        Returns:
        a new TaskResult object
      • sendTokens

        public static void sendTokens​(TaskContextImpl taskContext,
                                      TaskResultImpl taskResult)
        Send tokens for a serialized task result.
        Parameters:
        taskContext - task context
        taskResult - task result