hudson.model
Interface Queue.Task

All Superinterfaces:
ModelObject, ResourceActivity, SubTask
All Known Subinterfaces:
BuildableItem, BuildableItemWithBuildWrappers, Queue.FlyweightTask, Queue.NonBlockingTask, Queue.TransientTask, SCMedItem
All Known Implementing Classes:
AbstractMavenProject, AbstractProject, AbstractQueueTask, FreeStyleProject, MatrixConfiguration, MatrixProject, MavenModule, MavenModuleSet, Project, QueueTaskFilter
Enclosing class:
Queue

public static interface Queue.Task
extends ModelObject, SubTask

Task whose execution is controlled by the queue.

Value equality of Queue.TransientTasks is used to collapse two tasks into one. This is used to avoid infinite queue backlog.

Pending Queue.TransientTasks are persisted when Hudson shuts down, so it needs to be persistable via XStream. To create a non-persisted transient Task, extend Queue.TransientTask marker interface.

Plugins are encouraged to extend from AbstractQueueTask instead of implementing this interface directly, to maintain compatibility with future changes to this interface.

For historical reasons, Queue.TransientTask object by itself also represents the "primary" sub-task (and as implied by this design, a Queue.TransientTask must have at least one sub-task.) Most of the time, the primary subtask is the only sub task.


Method Summary
 void checkAbortPermission()
          Checks the permission to see if the current user can abort this executable.
 CauseOfBlockage getCauseOfBlockage()
          If the execution of this task should be blocked for temporary reasons, this method returns a non-null object explaining why.
 String getFullDisplayName()
           
 String getName()
          Unique name of this task.
 Collection<? extends SubTask> getSubTasks()
          Obtains the SubTasks that constitute this task.
 String getUrl()
          Returns the URL of this task relative to the context root of the application.
 String getWhyBlocked()
          Deprecated. as of 1.330 Use CauseOfBlockage.getShortDescription() instead.
 boolean hasAbortPermission()
          Works just like checkAbortPermission() except it indicates the status by a return value, instead of exception.
 boolean isBuildBlocked()
          Returns true if the execution should be blocked for temporary reasons.
 boolean isConcurrentBuild()
          True if the task allows concurrent builds, where the same Queue.TransientTask is executed by multiple executors concurrently on the same or different nodes.
 
Methods inherited from interface hudson.model.ModelObject
getDisplayName
 
Methods inherited from interface hudson.model.queue.SubTask
createExecutable, getAssignedLabel, getEstimatedDuration, getLastBuiltOn, getOwnerTask, getSameNodeConstraint
 
Methods inherited from interface hudson.model.ResourceActivity
getDisplayName, getResourceList
 

Method Detail

isBuildBlocked

boolean isBuildBlocked()
Returns true if the execution should be blocked for temporary reasons.

Short-hand for getCauseOfBlockage()!=null.


getWhyBlocked

String getWhyBlocked()
Deprecated. as of 1.330 Use CauseOfBlockage.getShortDescription() instead.


getCauseOfBlockage

CauseOfBlockage getCauseOfBlockage()
If the execution of this task should be blocked for temporary reasons, this method returns a non-null object explaining why.

Otherwise this method returns null, indicating that the build can proceed right away.

This can be used to define mutual exclusion that goes beyond ResourceActivity.getResourceList().


getName

String getName()
Unique name of this task.

This method is no longer used, left here for compatibility. Just return ModelObject.getDisplayName().


getFullDisplayName

String getFullDisplayName()
See Also:
Item.getFullDisplayName()

checkAbortPermission

void checkAbortPermission()
Checks the permission to see if the current user can abort this executable. Returns normally from this method if it's OK.

Throws:
org.acegisecurity.AccessDeniedException - if the permission is not granted.

hasAbortPermission

boolean hasAbortPermission()
Works just like checkAbortPermission() except it indicates the status by a return value, instead of exception.


getUrl

String getUrl()
Returns the URL of this task relative to the context root of the application.

When the user clicks an item in the queue, this is the page where the user is taken to. Hudson expects the current instance to be bound to the URL returned by this method.

Returns:
URL that ends with '/'.

isConcurrentBuild

boolean isConcurrentBuild()
True if the task allows concurrent builds, where the same Queue.TransientTask is executed by multiple executors concurrently on the same or different nodes.

Since:
1.338

getSubTasks

Collection<? extends SubTask> getSubTasks()
Obtains the SubTasks that constitute this task.

The collection returned by this method must also contain the primary SubTask represented by this Queue.TransientTask object itself as the first element. The returned value is read-only.

At least size 1.

Since this is a newly added method, the invocation may results in AbstractMethodError. Use Tasks#getSubTasksOf(Task) that avoids this.

Since:
1.377


Copyright © 2004-2013. All Rights Reserved.