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
Fields Modifier and Type Field Description Queue.TasktaskProject to be built.
-
Constructor Summary
Constructors Modifier Constructor Description protectedItem(Queue.Item item)protectedItem(Queue.Task task, List<Action> actions, long id, FutureImpl future)protectedItem(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 Authenticationauthenticate()Deprecated.useauthenticate2()org.springframework.security.core.Authenticationauthenticate2()Returns the identity that this task carries when it runs, for the purpose of access control.org.kohsuke.stapler.HttpResponsedoCancelQueue()Deprecated.UseQueue.doCancelItem(long)instead.ApigetApi()LabelgetAssignedLabel()If this task needs to be run on a node with a particular label, return thatLabel.LabelgetAssignedLabelFor(SubTask st)Test if the specifiedSubTaskneeds to be run on a node with a particular label.abstract CauseOfBlockagegetCauseOfBlockage()Gets an object that describes why this item is in the queue.List<Cause>getCauses()Convenience method that returns a read only view of theCauses associated with this item in the queue.StringgetCausesDescription()Convenience method that returns a read only view of theCauses associated with this item in the queue as a single string.QueueTaskFuture<Queue.Executable>getFuture()Can be used to wait for the completion (either normal, abnormal, or cancellation) of theQueue.Task.longgetId()Unique ID (per master) that tracks theQueue.Taskas it moves through different stages in the queue (each represented by different subtypes ofQueue.Itemand into any subsequentRuninstance (seeRun.getQueueId()).intgetIdLegacy()Deprecated.StringgetInQueueForString()Returns a human readable presentation of how long this item is already in the queue.longgetInQueueSince()Since when is this item in the queue.StringgetParams()Gets a human-readable message about the parameters of this itemStringgetSearchUrl()Returns the URL of this item relative to the parentSearchItem.Queue.TaskgetTask()StringgetUrl()Returns the URL of thisQueue.Itemrelative to the context path of JenkinsStringgetWhy()Gets a human-readable status message describing why it's in the queue.booleanisBlocked()Build is blocked because another build is in progress, requiredResources are not available, or otherwise blocked byQueue.Task.isBuildBlocked().booleanisBuildable()Build is waiting the executor to become available.booleanisStuck()True if the item is starving for an executor for too long.protected ObjectreadResolve()StringtoString()-
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
-
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
-
-
-
-
Field Detail
-
task
@Exported @NonNull public final Queue.Task task
Project to be built.
-
-
Constructor Detail
-
Item
protected Item(@NonNull Queue.Task task, @NonNull List<Action> actions, long id, FutureImpl future)
-
Item
protected Item(@NonNull Queue.Task task, @NonNull 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.Taskas it moves through different stages in the queue (each represented by different subtypes ofQueue.Itemand into any subsequentRuninstance (seeRun.getQueueId()).
-
getIdLegacy
@Deprecated public int getIdLegacy()
Deprecated.
-
getTask
@NonNull public Queue.Task getTask()
- Specified by:
getTaskin interfaceQueueItem- Returns:
- The underlying
Queue.Taskcurrently in queue.
-
isBlocked
@Exported public boolean isBlocked()
Build is blocked because another build is in progress, requiredResources 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'- Specified by:
getInQueueForStringin 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
@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
LabelAssignmentActioninto account, then fall back toSubTask.getAssignedLabel()
-
getAssignedLabelFor
@CheckForNull public Label getAssignedLabelFor(@NonNull SubTask st)
Test if the specifiedSubTaskneeds to be run on a node with a particular label.This method takes
LabelAssignmentActioninto 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 theCauses 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()
Description copied from interface:QueueItemConvenience method that returns a read only view of theCauses associated with this item in the queue as a single string.- Specified by:
getCausesDescriptionin interfaceQueueItem
-
getUrl
@Exported public String getUrl()
Returns the URL of thisQueue.Itemrelative 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
-
getSearchUrl
public String getSearchUrl()
Description copied from interface:SearchItemReturns the URL of this item relative to the parentSearchItem.- Specified by:
getSearchUrlin 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 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 thisAuthenticationis allowed to use them. Implementers, if you are unsure, return the identity of the user who queued the task, orACL.SYSTEM2to 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()
-
-