Package hudson.model

Class 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.
  • Field Details

    • task

      @Exported @NonNull public final Queue.Task task
      Project to be built.
  • Constructor Details

  • Method Details

    • getId

      @Exported public long getId()
      Unique ID (per master) that tracks the Queue.Task as it moves through different stages in the queue (each represented by different subtypes of Queue.Item and into any subsequent Run instance (see Run.getQueueId()).
      Specified by:
      getId in interface QueueItem
      Since:
      1.601
    • getIdLegacy

      @Deprecated public int getIdLegacy()
      Deprecated.
    • getTask

      @NonNull public Queue.Task getTask()
      Specified by:
      getTask in interface QueueItem
      Returns:
      The underlying Queue.Task currently in queue.
    • isBlocked

      @Exported public boolean isBlocked()
      Build is blocked because another build is in progress, required Resources are not available, or otherwise blocked by Queue.Task.isBuildBlocked().
    • isBuildable

      @Exported public boolean isBuildable()
      Build is waiting the executor to become available. This flag is only used in Queue.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.
      Specified by:
      isStuck in interface QueueItem
      Returns:
      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:
      getInQueueForString in interface QueueItem
    • 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 the Queue.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 that Label. Otherwise null, indicating it can run on anywhere.

      This code takes LabelAssignmentAction into account, then fall back to SubTask.getAssignedLabel()

    • getAssignedLabelFor

      @CheckForNull public Label getAssignedLabelFor(@NonNull SubTask st)
      Test if the specified SubTask 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 to SubTask.getAssignedLabel()

      Parameters:
      st - SubTask to be checked.
      Returns:
      Required Label. Otherwise null, indicating it can run on anywhere.
    • getCauses

      public final List<Cause> getCauses()
      Convenience method that returns a read only view of the Causes 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: QueueItem
      Convenience method that returns a read only view of the Causes associated with this item in the queue as a single string.
      Specified by:
      getCausesDescription in interface QueueItem
    • getUrl

      @Exported public String getUrl()
      Returns the URL of this Queue.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.
      Specified by:
      getWhy in interface QueueItem
    • 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
      Specified by:
      getParams in interface QueueItem
      Returns:
      String
    • getSearchUrl

      public String getSearchUrl()
      Description copied from interface: SearchItem
      Returns the URL of this item relative to the parent SearchItem.
      Specified by:
      getSearchUrl in interface SearchItem
      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.
    • 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 this Authentication is allowed to use them. Implementers, if you are unsure, return the identity of the user who queued the task, or ACL.SYSTEM2 to bypass the access control and run as the super user.
      Since:
      2.266
    • authenticate

      @Deprecated public Authentication authenticate()
      Deprecated.
      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.StaplerRequest req)
    • readResolve

      protected Object readResolve()
    • toString

      public String toString()
      Overrides:
      toString in class Object