Package hudson.model
Class Queue.Item
- java.lang.Object
-
- hudson.model.AbstractModelObject
-
- hudson.model.Actionable
-
- hudson.model.Queue.Item
-
- All Implemented Interfaces:
ModelObject
,SearchableModelObject
,SearchItem
,ModelObjectWithContextMenu
- Direct Known Subclasses:
Queue.LeftItem
,Queue.NotWaitingItem
,Queue.WaitingItem
- Enclosing class:
- Queue
@ExportedBean(defaultVisibility=999) public abstract static class Queue.Item extends Actionable
Item in a queue.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem, ModelObjectWithContextMenu.MenuItemType
-
-
Field Summary
Fields Modifier and Type Field Description Queue.Task
task
Project to be built.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Item(Queue.Item item)
protected
Item(Queue.Task task, List<Action> actions, long id, FutureImpl future)
protected
Item(Queue.Task task, List<Action> actions, long id, FutureImpl future, long inQueueSince)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Authentication
authenticate()
Deprecated.useauthenticate2()
org.springframework.security.core.Authentication
authenticate2()
Returns the identity that this task carries when it runs, for the purpose of access control.org.kohsuke.stapler.HttpResponse
doCancelQueue()
Deprecated.UseQueue.doCancelItem(long)
instead.Api
getApi()
Label
getAssignedLabel()
If this task needs to be run on a node with a particular label, return thatLabel
.Label
getAssignedLabelFor(SubTask st)
Test if the specifiedSubTask
needs to be run on a node with a particular label.abstract CauseOfBlockage
getCauseOfBlockage()
Gets an object that describes why this item is in the queue.List<Cause>
getCauses()
Convenience method that returns a read only view of theCause
s associated with this item in the queue.String
getCausesDescription()
String
getDisplayName()
QueueTaskFuture<Queue.Executable>
getFuture()
Can be used to wait for the completion (either normal, abnormal, or cancellation) of theQueue.Task
.long
getId()
Unique ID (per master) that tracks theQueue.Task
as it moves through different stages in the queue (each represented by different subtypes ofQueue.Item
and into any subsequentRun
instance (seeRun.getQueueId()
).int
getIdLegacy()
Deprecated.String
getInQueueForString()
Returns a human readable presentation of how long this item is already in the queue.long
getInQueueSince()
Since when is this item in the queue.String
getParams()
Gets a human-readable message about the parameters of this itemString
getSearchUrl()
Returns the URL of this item relative to the parentSearchItem
.String
getUrl()
Returns the URL of thisQueue.Item
relative to the context path of JenkinsString
getWhy()
Gets a human-readable status message describing why it's in the queue.boolean
hasCancelPermission()
Checks whether a scheduled item may be canceled.boolean
isBlocked()
Build is blocked because another build is in progress, requiredResource
s are not available, or otherwise blocked byQueue.Task.isBuildBlocked()
.boolean
isBuildable()
Build is waiting the executor to become available.boolean
isStuck()
True if the item is starving for an executor for too long.protected Object
readResolve()
String
toString()
-
Methods inherited from class hudson.model.Actionable
addAction, addOrReplaceAction, doContextMenu, getAction, getAction, getActions, getActions, getAllActions, getDynamic, removeAction, removeActions, replaceAction, replaceActions
-
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
-
-
-
-
Field Detail
-
task
@Exported public final Queue.Task task
Project to be built.
-
-
Constructor Detail
-
Item
protected Item(Queue.Task task, List<Action> actions, long id, FutureImpl future)
-
Item
protected Item(Queue.Task task, List<Action> actions, long id, FutureImpl future, long inQueueSince)
-
Item
protected Item(Queue.Item item)
-
-
Method Detail
-
getId
@Exported public long getId()
Unique ID (per master) that tracks theQueue.Task
as it moves through different stages in the queue (each represented by different subtypes ofQueue.Item
and into any subsequentRun
instance (seeRun.getQueueId()
).- Since:
- 1.601
-
getIdLegacy
@Deprecated public int getIdLegacy()
Deprecated.
-
isBlocked
@Exported public boolean isBlocked()
Build is blocked because another build is in progress, requiredResource
s are not available, or otherwise blocked byQueue.Task.isBuildBlocked()
.
-
isBuildable
@Exported public boolean isBuildable()
Build is waiting the executor to become available. This flag is only used inQueue.getItems()
for 'pseudo' items that are actually not really in the queue.
-
isStuck
@Exported public boolean isStuck()
True if the item is starving for an executor for too long.
-
getInQueueSince
@Exported public long getInQueueSince()
Since when is this item in the queue.- Returns:
- Unix timestamp
-
getInQueueForString
public String getInQueueForString()
Returns a human readable presentation of how long this item is already in the queue. E.g. something like '3 minutes 40 seconds'
-
getFuture
@WithBridgeMethods(java.util.concurrent.Future.class) public QueueTaskFuture<Queue.Executable> getFuture()
Can be used to wait for the completion (either normal, abnormal, or cancellation) of theQueue.Task
.Just like
getId()
, the same object tracks various stages of the queue.
-
getAssignedLabel
@CheckForNull public Label getAssignedLabel()
If this task needs to be run on a node with a particular label, return thatLabel
. Otherwise null, indicating it can run on anywhere.This code takes
LabelAssignmentAction
into account, then fall back toSubTask.getAssignedLabel()
-
getAssignedLabelFor
@CheckForNull public Label getAssignedLabelFor(@NonNull SubTask st)
Test if the specifiedSubTask
needs to be run on a node with a particular label.This method takes
LabelAssignmentAction
into account, the first non-null assignment will be returned. Otherwise falls back toSubTask.getAssignedLabel()
-
getCauses
public final List<Cause> getCauses()
Convenience method that returns a read only view of theCause
s associated with this item in the queue.- Returns:
- can be empty but never null
- Since:
- 1.343
-
getCausesDescription
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public String getCausesDescription()
-
getUrl
@Exported public String getUrl()
Returns the URL of thisQueue.Item
relative to the context path of Jenkins- Returns:
- URL that ends with '/'.
- Since:
- 1.519
-
getWhy
@Exported public final String getWhy()
Gets a human-readable status message describing why it's in the queue.
-
getCauseOfBlockage
public abstract CauseOfBlockage getCauseOfBlockage()
Gets an object that describes why this item is in the queue.
-
getParams
@Exported public String getParams()
Gets a human-readable message about the parameters of this item- Returns:
- String
-
hasCancelPermission
public boolean hasCancelPermission()
Checks whether a scheduled item may be canceled.- Returns:
- by default, the same as
Queue.Task.hasAbortPermission()
-
getDisplayName
public String getDisplayName()
-
getSearchUrl
public String getSearchUrl()
Description copied from interface:SearchItem
Returns the URL of this item relative to the parentSearchItem
.- Returns:
- URL like "foo" or "foo/bar". The path can end with '/'. The path that starts with '/' will be interpreted as the absolute path (within the context path of Jenkins.)
-
doCancelQueue
@Deprecated public org.kohsuke.stapler.HttpResponse doCancelQueue()
Deprecated.UseQueue.doCancelItem(long)
instead.
-
authenticate2
@NonNull public org.springframework.security.core.Authentication authenticate2()
Returns the identity that this task carries when it runs, for the purpose of access control. When the task execution touches other objects inside Jenkins, the access control is performed based on whether thisAuthentication
is allowed to use them. Implementers, if you are unsure, return the identity of the user who queued the task, orACL.SYSTEM2
to bypass the access control and run as the super user.- Since:
- 2.266
-
authenticate
@Deprecated public Authentication authenticate()
Deprecated.useauthenticate2()
- Since:
- 1.520
-
getApi
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public Api getApi() throws org.springframework.security.access.AccessDeniedException
- Throws:
org.springframework.security.access.AccessDeniedException
-
readResolve
protected Object readResolve()
-
-