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 -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedItem(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
Modifier and TypeMethodDescriptionDeprecated.org.springframework.security.core.AuthenticationReturns the identity that this task carries when it runs, for the purpose of access control.org.kohsuke.stapler.HttpResponseDeprecated.UseQueue.doCancelItem(long)instead.getApi()If this task needs to be run on a node with a particular label, return thatLabel.Test if the specifiedSubTaskneeds to be run on a node with a particular label.abstract CauseOfBlockageGets an object that describes why this item is in the queue.Convenience method that returns a read only view of theCauses associated with this item in the queue.Convenience method that returns a read only view of theCauses 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.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()).intDeprecated.Returns a human readable presentation of how long this item is already in the queue.longSince 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.Itemrelative to the context path of Jenkinsfinal StringgetWhy()Gets a human-readable status message describing why it's in the queue.booleanBuild is blocked because another build is in progress, requiredResources are not available, or otherwise blocked byQueue.Task.isBuildBlocked().booleanBuild is waiting the executor to become available.booleanisStuck()True if the item is starving for an executor for too long.protected ObjecttoString()Methods inherited from class hudson.model.Actionable
addAction, addOrReplaceAction, doContextMenu, getAction, getAction, getActions, getActions, getAllActions, getDynamic, removeAction, removeActions, replaceAction, replaceActionsMethods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendErrorMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface jenkins.model.queue.QueueItem
getDisplayName, hasCancelPermission
-
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.Taskas it moves through different stages in the queue (each represented by different subtypes ofQueue.Itemand into any subsequentRuninstance (seeRun.getQueueId()). -
getIdLegacy
Deprecated. -
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
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
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
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
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
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
Returns the URL of thisQueue.Itemrelative 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: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.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.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
-
toString
-
authenticate2()