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
,QueueItem
- Direct Known Subclasses:
Queue.LeftItem
,Queue.NotWaitingItem
,Queue.WaitingItem
- Enclosing class:
- Queue
@ExportedBean(defaultVisibility=999)
public abstract static class Queue.Item
extends Actionable
implements QueueItem
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
-
Constructor Summary
ModifierConstructorDescriptionprotected
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
Modifier and TypeMethodDescriptionDeprecated.org.springframework.security.core.Authentication
Returns the identity that this task carries when it runs, for the purpose of access control.org.kohsuke.stapler.HttpResponse
Deprecated.UseQueue.doCancelItem(long)
instead.org.kohsuke.stapler.HttpResponse
doIndex
(org.kohsuke.stapler.StaplerRequest2 req) getApi()
If this task needs to be run on a node with a particular label, return thatLabel
.Test if the specifiedSubTask
needs to be run on a node with a particular label.abstract CauseOfBlockage
Gets an object that describes why this item is in the queue.Convenience method that returns a read only view of theCause
s associated with this item in the queue.Convenience method that returns a read only view of theCause
s associated with this item in the queue as a single string.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
Deprecated.Returns a human readable presentation of how long this item is already in the queue.long
Since when is this item in the queue.Gets a human-readable message about the parameters of this itemReturns the URL of this item relative to the parentSearchItem
.getTask()
getUrl()
Returns the URL of thisQueue.Item
relative to the context path of Jenkinsfinal String
getWhy()
Gets a human-readable status message describing why it's in the queue.boolean
Build is blocked because another build is in progress, requiredResource
s are not available, or otherwise blocked byQueue.Task.isBuildBlocked()
.boolean
Build is waiting the executor to become available.boolean
isStuck()
True if the item is starving for an executor for too long.protected Object
toString()
Methods inherited from class hudson.model.Actionable
addAction, addOrReplaceAction, doContextMenu, doContextMenu, getAction, getAction, getActions, getActions, getAllActions, getDynamic, getDynamic, removeAction, removeActions, replaceAction, replaceActions
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendError
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface jenkins.model.queue.QueueItem
getDisplayName, hasCancelPermission
Methods inherited from interface hudson.search.SearchItem
getSearchIcon
-
Field Details
-
task
Project to be built.
-
-
Constructor Details
-
Item
-
Item
protected Item(@NonNull Queue.Task task, @NonNull List<Action> actions, long id, FutureImpl future, long inQueueSince) -
Item
-
-
Method Details
-
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()
). -
getIdLegacy
Deprecated. -
getTask
- Specified by:
getTask
in interfaceQueueItem
- Returns:
- The underlying
Queue.Task
currently in queue.
-
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
Returns a human readable presentation of how long this item is already in the queue. E.g. something like '3 minutes 40 seconds'- Specified by:
getInQueueForString
in interfaceQueueItem
-
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
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
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
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
Description copied from interface:QueueItem
Convenience method that returns a read only view of theCause
s associated with this item in the queue as a single string.- Specified by:
getCausesDescription
in interfaceQueueItem
-
getUrl
Returns the URL of thisQueue.Item
relative to the context path of Jenkins- Returns:
- URL that ends with '/'.
- Since:
- 1.519
-
getWhy
Gets a human-readable status message describing why it's in the queue. -
getCauseOfBlockage
Gets an object that describes why this item is in the queue. -
getParams
Gets a human-readable message about the parameters of this item -
getSearchUrl
Description copied from interface:SearchItem
Returns the URL of this item relative to the parentSearchItem
.- Specified by:
getSearchUrl
in interfaceSearchItem
- 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.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.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
-
doIndex
public org.kohsuke.stapler.HttpResponse doIndex(org.kohsuke.stapler.StaplerRequest2 req) -
readResolve
-
toString
-
authenticate2()