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
 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.
 Date getFinishedTimestamp()
          Return the date when the task was finished.
 String getProgressURL()
          Returns the URL that displays progress on this task.
 V getResult()
          This returns the result of the long running task.
 Date getStartedTimestamp()
          Return the date when the task was started.
 Date getSubmittedTimestamp()
          Return the date when the task was submitted.
 TaskContext getTaskContext()
          Return he context of task.
 Long getTaskId()
          Reuturn the identifier for this task.
 TaskProgressIndicator getTaskProgressIndicator()
          Return the TaskProgressIndicator associated with the task.
 com.atlassian.crowd.embedded.api.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 ExecutionException,
                   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:
ExecutionException - if an uncaught exception is thrown from the task's callable.
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

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

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

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

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.atlassian.crowd.embedded.api.User getUser()
Return the user that started to task.

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

getDescription

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

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-2012 Atlassian. All Rights Reserved.