public static interface Queue.Task extends ModelObject, SubTask
Value equality
of Queue.Task
s is used
to collapse two tasks into one. This is used to avoid infinite
queue backlog.
Pending Queue.Task
s 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.
Plugins are encouraged to implement AccessControlled
otherwise
the tasks will be hidden from display in the queue.
For historical reasons, Queue.Task
object by itself
also represents the "primary" sub-task (and as implied by this
design, a Queue.Task
must have at least one sub-task.)
Most of the time, the primary subtask is the only sub task.
Modifier and Type | Method and Description |
---|---|
void |
checkAbortPermission()
Checks the permission to see if the current user can abort this executable.
|
default CauseOfBlockage |
getCauseOfBlockage()
If the execution of this task should be blocked for temporary reasons,
this method returns a non-null object explaining why.
|
default org.acegisecurity.Authentication |
getDefaultAuthentication()
This method allows the task to provide the default fallback authentication object to be used
when
QueueItemAuthenticator fails to authenticate the build. |
default org.acegisecurity.Authentication |
getDefaultAuthentication(Queue.Item item)
This method allows the task to provide the default fallback authentication object to be used
when
QueueItemAuthenticator fails to authenticate the build. |
String |
getFullDisplayName() |
String |
getName()
Unique name of this task.
|
default Collection<? extends SubTask> |
getSubTasks()
Obtains the
SubTask s that constitute this task. |
String |
getUrl()
Returns the URL of this task relative to the context root of the application.
|
default 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. |
default boolean |
isBuildBlocked()
Deprecated.
Use
getCauseOfBlockage() != null |
default boolean |
isConcurrentBuild()
True if the task allows concurrent builds, where the same
Queue.Task is executed
by multiple executors concurrently on the same or different nodes. |
getDisplayName
createExecutable, getAssignedLabel, getEstimatedDuration, getLastBuiltOn, getOwnerTask, getSameNodeConstraint
getDisplayName, getResourceList
@Deprecated default boolean isBuildBlocked()
getCauseOfBlockage()
!= null@Deprecated default String getWhyBlocked()
CauseOfBlockage.getShortDescription()
instead.@CheckForNull default CauseOfBlockage getCauseOfBlockage()
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()
.
String getName()
This method is no longer used, left here for compatibility. Just return ModelObject.getDisplayName()
.
String getFullDisplayName()
Item.getFullDisplayName()
void checkAbortPermission()
NOTE: If you have implemented AccessControlled
this should just be
checkPermission(hudson.model.Item.CANCEL);
org.acegisecurity.AccessDeniedException
- if the permission is not granted.boolean hasAbortPermission()
checkAbortPermission()
except it indicates the status by a return value,
instead of exception.
Also used by default for Queue.Item.hasCancelPermission()
.
NOTE: If you have implemented AccessControlled
this should just be
return hasPermission(hudson.model.Item.CANCEL);
String getUrl()
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.
default boolean isConcurrentBuild()
Queue.Task
is executed
by multiple executors concurrently on the same or different nodes.default Collection<? extends SubTask> getSubTasks()
SubTask
s that constitute this task.
The collection returned by this method must also contain the primary SubTask
represented by this Queue.Task
object itself as the first element.
The returned value is read-only.
At least size 1.
this
@Nonnull default org.acegisecurity.Authentication getDefaultAuthentication()
QueueItemAuthenticator
fails to authenticate the build.
When the task execution touches other objects inside Jenkins, the access control is performed
based on whether this Authentication
is allowed to use them.
ACL.SYSTEM
QueueItemAuthenticator
,
Tasks.getDefaultAuthenticationOf(Queue.Task)
@Nonnull default org.acegisecurity.Authentication getDefaultAuthentication(Queue.Item item)
QueueItemAuthenticator
fails to authenticate the build.
When the task execution touches other objects inside Jenkins, the access control is performed
based on whether this Authentication
is allowed to use them.
This method was added to an interface after it was created, so plugins built against
older versions of Jenkins may not have this method implemented. Called private method _getDefaultAuthenticationOf(Task) on Tasks
to avoid AbstractMethodError
.
QueueItemAuthenticator
,
Tasks.getDefaultAuthenticationOf(Queue.Task, Queue.Item)
Copyright © 2004–2018. All rights reserved.