Class QueueItemCache

java.lang.Object
jenkins.advancedqueue.sorter.QueueItemCache

public class QueueItemCache extends Object
Keeps track of the Queue.Items seen by the Sorter. Uses a WeakHash to store the entries that have left the queue, this can be used by Strategies that needs this info but still minimizes the need to lookup the data again from Jenkins Core.
Since:
2.3
Author:
Magnus Sandberg
  • Method Details

    • get

      public static QueueItemCache get()
    • getItem

      public ItemInfo getItem(long itemId)
    • getItem

      @Deprecated public ItemInfo getItem(Integer itemId)
      Deprecated.
      Gets the Item for and itemId/queueId
      Parameters:
      itemId - the id of a Job currently in the queue
      Returns:
      the ItemInfo for the provided id or null if the id is not in the queue
    • getItem

      @CheckForNull public ItemInfo getItem(String jobName)
      Get the ItemInfo for the last knows start of this Job Name
      Parameters:
      jobName - a name of a Job
      Returns:
      the ItemInfo for the last know start of the Job. Can be null if job didn't run yet
    • addItem

      public ItemInfo addItem(ItemInfo itemInfo)
    • removeItem

      @CheckForNull @Deprecated public ItemInfo removeItem(Integer itemId)
      Deprecated.
    • removeItem

      @CheckForNull public ItemInfo removeItem(long itemId)
    • getSortedList

      public List<ItemInfo> getSortedList()
      This method will return a sorted list of all known and active ItemInfos this will include Items mapped to Queue.BuildableItems as well as Queue.BlockedItems
      Returns:
      the sorted list of all ItemInfos