Class MockTaskDescriptor<V extends Serializable>

java.lang.Object
com.atlassian.jira.task.MockTaskDescriptor<V>
All Implemented Interfaces:
TaskDescriptor<V>, Serializable

public class MockTaskDescriptor<V extends Serializable> extends Object implements TaskDescriptor<V>
Since:
v5.1
See Also:
  • Constructor Details

    • MockTaskDescriptor

      public MockTaskDescriptor()
  • Method Details

    • clear

      public void clear()
    • getResult

      public V getResult()
      Description copied from interface: TaskDescriptor
      This returns the result of the long running task. Returns null if the task is not finished.
      Specified by:
      getResult in interface TaskDescriptor<V extends Serializable>
      Returns:
      the result of the long running task or null if it has not return value.
    • isStarted

      public boolean isStarted()
      Description copied from interface: TaskDescriptor
      True if the task has been started.
      Specified by:
      isStarted in interface TaskDescriptor<V extends Serializable>
      Returns:
      true if the task has been started.
    • isFinished

      public boolean isFinished()
      Description copied from interface: TaskDescriptor
      Tells if caller if the task has finished running or not.
      Specified by:
      isFinished in interface TaskDescriptor<V extends Serializable>
      Returns:
      true if the task has finished running.
    • getTaskId

      public Long getTaskId()
      Description copied from interface: TaskDescriptor
      Return the identifier for this task. This is only unique in the current execution of the JVM.
      Specified by:
      getTaskId in interface TaskDescriptor<V extends Serializable>
      Returns:
      The unique id of the task
    • getStartedTimestamp

      public Date getStartedTimestamp()
      Description copied from interface: TaskDescriptor
      Return the date when the task was started.
      Specified by:
      getStartedTimestamp in interface TaskDescriptor<V extends Serializable>
      Returns:
      the time that task was started. null will be returned if the task has not started executing.
    • getFinishedTimestamp

      public Date getFinishedTimestamp()
      Description copied from interface: TaskDescriptor
      Return the date when the task was finished.
      Specified by:
      getFinishedTimestamp in interface TaskDescriptor<V extends Serializable>
      Returns:
      the time that task finished executing. null will be returned if the task has not finished executing.
    • getSubmittedTimestamp

      public Date getSubmittedTimestamp()
      Description copied from interface: TaskDescriptor
      Return the date when the task was submitted.
      Specified by:
      getSubmittedTimestamp in interface TaskDescriptor<V extends Serializable>
      Returns:
      the time that task was submitted to the TaskManager. A null value will never be returned as the task will always have a submission time.
    • getElapsedRunTime

      public long getElapsedRunTime()
      Description copied from interface: TaskDescriptor
      This returns number of milliseconds the task has been running for. Will return zero if the task has not started. When the task has started but not finished, it will return the the difference between the current time and the time was started (i.e. it will change). When the task has finished, it will return the difference between the start time and the end time (i.e. it will not change).
      Specified by:
      getElapsedRunTime in interface TaskDescriptor<V extends Serializable>
      Returns:
      the elapsed run time in milliseconds.
    • getUserName

      public String getUserName()
      Description copied from interface: TaskDescriptor
      Return the user that started to task.
      Specified by:
      getUserName in interface TaskDescriptor<V extends Serializable>
      Returns:
      the user that caused the task to be submitted. This may be null.
    • getDescription

      public String getDescription()
      Description copied from interface: TaskDescriptor
      Return the description of the task passed when it was created.
      Specified by:
      getDescription in interface TaskDescriptor<V extends Serializable>
      Returns:
      a meaningful description of the task
    • getTaskContext

      public TaskContext getTaskContext()
      Description copied from interface: TaskDescriptor
      Return the context of task. Code that starts long running tasks can implement their own variants of this.
      Specified by:
      getTaskContext in interface TaskDescriptor<V extends Serializable>
      Returns:
      the context of the task. This method will never return null as a task must always have a context.
    • getProgressURL

      public String getProgressURL()
      Description copied from interface: TaskDescriptor
      Returns the URL that displays progress on this task. It is built using the TaskContext.
      Specified by:
      getProgressURL in interface TaskDescriptor<V extends Serializable>
      Returns:
      the URL that displays progress for this task. null cannot be returned.
    • getTaskProgressIndicator

      public TaskProgressIndicator getTaskProgressIndicator()
      Description copied from interface: TaskDescriptor
      Return the TaskProgressIndicator associated with the task. A task will only have an indicator if its callable implements the ProvidesTaskProgress interface.
      Specified by:
      getTaskProgressIndicator in interface TaskDescriptor<V extends Serializable>
      Returns:
      the TaskProgressIndicator associated with the task or null if there isn't one.
    • setResult

      public void setResult(V result)
      Description copied from interface: TaskDescriptor
      Store the result in the descriptor.
      Specified by:
      setResult in interface TaskDescriptor<V extends Serializable>
      Parameters:
      result - The Result
    • setSubmittedTime

      public void setSubmittedTime(Date submittedTime)
    • setStartedTime

      public void setStartedTime(Date startedTime)
    • setFinishedTime

      public void setFinishedTime(Date finishedTime)
    • setTaskProgressIndicator

      public void setTaskProgressIndicator(TaskProgressIndicator taskProgressIndicator)
    • setDescription

      public void setDescription(String description)
    • setTaskId

      public void setTaskId(Long taskId)
    • setElapsedRunTime

      public void setElapsedRunTime(long elapsedRunTime)
    • setTaskContext

      public void setTaskContext(TaskContext taskContext)
    • setUserName

      public void setUserName(String userName)
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: TaskDescriptor
      Returns whether cancellation of task has been requested. Long-running operations should poll to see if task has been requested.
      Specified by:
      isCancelled in interface TaskDescriptor<V extends Serializable>
      Returns:
      true if cancellation has been requested, and false otherwise
    • setCancelled

      public void setCancelled(boolean cancelled)
      Description copied from interface: TaskDescriptor
      Set flag to indicate this task has been cancelled;
      Specified by:
      setCancelled in interface TaskDescriptor<V extends Serializable>
      Parameters:
      cancelled - Cancelled flag
    • isSelfRecovering

      public boolean isSelfRecovering()
      Description copied from interface: TaskDescriptor
      Returns whether the task will be automatically picked up again by the cluster if the node that was executing it crashes.

      Used by Jira to determine which tasks it should clean up after detecting such crashed node.

      Specified by:
      isSelfRecovering in interface TaskDescriptor<V extends Serializable>
      See Also:
    • setSelfRecovering

      public void setSelfRecovering(boolean selfRecovering)
    • isCancellable

      public boolean isCancellable()
      Description copied from interface: TaskDescriptor
      Returns whether this supports requests to cancel it.
      Specified by:
      isCancellable in interface TaskDescriptor<V extends Serializable>
      Returns:
      true if cancellation is supported, and false otherwise
    • setCancelable

      public void setCancelable(boolean isCancelable)
    • getNodeId

      public String getNodeId()
      Description copied from interface: TaskDescriptor
      Returns node id from where task was submitted
      Specified by:
      getNodeId in interface TaskDescriptor<V extends Serializable>
      Returns:
      node id
    • setNodeId

      public void setNodeId(String nodeId)
    • getSpanningOperation

      @Nullable public SpanningOperation getSpanningOperation()
      Description copied from interface: TaskDescriptor
      Return operation that this task is part of.
      Specified by:
      getSpanningOperation in interface TaskDescriptor<V extends Serializable>
      Returns:
      operation that this task is part of
    • setSpanningOperation

      public void setSpanningOperation(SpanningOperation spanningOperation)