Class DurableBackgroundTaskResult<R>

  • Type Parameters:
    R - Type of the result of the task.

    public class DurableBackgroundTaskResult<R>
    extends Object
    Result of executing a durable background task.

    There may be the following states:

    • Completed - the task has completed its execution and should be deleted.
    • Restart - the task has not yet completed its execution and must be restarted.
    • Method Detail

      • complete

        public static <R> DurableBackgroundTaskResult<R> complete​(@Nullable
                                                                  @Nullable Throwable err)
        Creation of a completed task execution result that does not require restarting it.
        Parameters:
        err - An error occurred while executing the task.
        Returns:
        Result of executing a durable background task.
      • complete

        public static <R> DurableBackgroundTaskResult<R> complete​(@Nullable
                                                                  R res)
        Creation of a completed task execution result that does not require restarting it.
        Parameters:
        res - Result of the task.
        Returns:
        Result of executing a durable background task.
      • complete

        public static <R> DurableBackgroundTaskResult<R> complete()
        Creation of a completed task execution result that does not require restarting it.
        Returns:
        Result of executing a durable background task.
      • restart

        public static <R> DurableBackgroundTaskResult<R> restart​(@Nullable
                                                                 @Nullable Throwable err)
        Creation of a task execution result that requires its restart.
        Parameters:
        err - An error occurred while executing the task.
        Returns:
        Result of executing a durable background task.
      • completed

        public boolean completed()
        Checking the completion of the task.
        Returns:
        True if completed.
      • restart

        public boolean restart()
        Checking if the task needs to be restarted.
        Returns:
        True if the task needs to be restarted.
      • error

        @Nullable
        public @Nullable Throwable error()
        Getting a task execution error.
        Returns:
        An error occurred while executing the task.
      • result

        @Nullable
        public R result()
        Getting the result of the task.
        Returns:
        Result of the task.