com.atlassian.jira.task
Interface TaskDescriptor<V>

All Known Implementing Classes:
TaskDescriptorBean

public interface TaskDescriptor<V>

TaskDescriptor decribes the state of a long running task.

Since:
v3.13

Method Summary
 java.lang.String getDescription()
          Return the description of the task passed when it was created.
 long getElapsedRunTime()
          This returns number of milliseconds the task has been running for.
 java.util.Date getFinishedTimestamp()
          Return the date when the task was finished.
 java.lang.String getProgressURL()
          Returns the URL that displays progress on this task.
 V getResult()
          This returns the result of the long running task.
 java.util.Date getStartedTimestamp()
          Return the date when the task was started.
 java.util.Date getSubmittedTimestamp()
          Return the date when the task was submitted.
 TaskContext getTaskContext()
          Return he context of task.
 java.lang.Long getTaskId()
          Reuturn the identifier for this task.
 TaskProgressIndicator getTaskProgressIndicator()
          Return the TaskProgressIndicator associated with the task.
 com.opensymphony.user.User getUser()
          Return the user that started to task.
 boolean isFinished()
          Tells if caller if the task has finished running or not.
 boolean isStarted()
          True if the task has been started.
 

Method Detail

getResult

V getResult()
            throws java.util.concurrent.ExecutionException,
                   java.lang.InterruptedException
This returns the result of the long running task. WARNING: This will BLOCK if the task has not finished and will not return until it has finished executing.

Returns:
the result of the long running task or null if it has not return value.
Throws:
java.util.concurrent.ExecutionException - if an uncaught exception is thrown from the task's callable.
java.lang.InterruptedException - if the calling thread is interrupted while waiting for the result.

isStarted

boolean isStarted()
True if the task has been started.

Returns:
true if the task has been started.

isFinished

boolean isFinished()
Tells if caller if the task has finished running or not.

Returns:
true if the task has finished running.

getTaskId

java.lang.Long getTaskId()
Reuturn the identifier for this task. This is only unique in the current execution of the JVM.

Returns:
The unique id of the task

getStartedTimestamp

java.util.Date getStartedTimestamp()
Return the date when the task was started.

Returns:
the time that task was started. null will be returned if the task has not started executing.

getFinishedTimestamp

java.util.Date getFinishedTimestamp()
Return the date when the task was finished.

Returns:
the time that task finished executing. null will be returned if the task has not finished executing.

getSubmittedTimestamp

java.util.Date getSubmittedTimestamp()
Return the date when the task was submitted.

Returns:
the time that task was submited to the TaskManager. A null value will never be returned as the task will always have a submission time.

getElapsedRunTime

long getElapsedRunTime()
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).

Returns:
the elapsed run time in milliseconds.

getUser

com.opensymphony.user.User getUser()
Return the user that started to task.

Returns:
the user that caused the task to be submitted. This may be null.

getDescription

java.lang.String getDescription()
Return the description of the task passed when it was created.

Returns:
a meaningful description of the task

getTaskContext

TaskContext getTaskContext()
Return he context of task. Code that starts long running tasks can implement their own variants of this.

Returns:
the context of the task. This method will never return null as a task must always have a context.

getProgressURL

java.lang.String getProgressURL()
Returns the URL that displays progress on this task. It is built using the TaskContext.

Returns:
the URL that displays progress for this task. null cannot be returned.

getTaskProgressIndicator

TaskProgressIndicator getTaskProgressIndicator()
Return the TaskProgressIndicator associated with the task. A task will only have an indictator if its callable implements the ProvidesTaskProgress interface.

Returns:
the TaskProgressIndicator associated with the task or null if there isn't one.


Copyright © 2002-2010 Atlassian. All Rights Reserved.