Class QueueSorter

java.lang.Object
hudson.model.queue.QueueSorter
All Implemented Interfaces:
ExtensionPoint
Direct Known Subclasses:
AbstractQueueSorterImpl

public abstract class QueueSorter extends Object implements ExtensionPoint
Singleton extension point for sorting buildable items
Since:
1.343
  • Field Details

    • DEFAULT_BLOCKED_ITEM_COMPARATOR

      public static final Comparator<Queue.BlockedItem> DEFAULT_BLOCKED_ITEM_COMPARATOR
      A comparator that sorts Queue.BlockedItem instances based on how long they have been in the queue. (We want the time since in queue by default as blocking on upstream/downstream considers waiting items also and thus the blocking starts once the task is in the queue not once the task is buildable)
      Since:
      1.618
  • Constructor Details

    • QueueSorter

      public QueueSorter()
  • Method Details

    • sortBuildableItems

      public abstract void sortBuildableItems(List<Queue.BuildableItem> buildables)
      Sorts the buildable items list. The items at the beginning will be executed before the items at the end of the list.
      Parameters:
      buildables - List of buildable items in the queue. Never null.
    • sortBlockedItems

      public void sortBlockedItems(List<Queue.BlockedItem> blockedItems)
      Sorts the blocked items list. The items at the beginning will be considered for removal from the blocked state before the items at the end of the list.
      Parameters:
      blockedItems - List of blocked items in the queue. Never null.
      Since:
      1.618
    • all

      public static ExtensionList<QueueSorter> all()
      All registered QueueSorters. Only the first one will be picked up, unless explicitly overridden by Queue.setSorter(QueueSorter).
    • installDefaultQueueSorter

      @Initializer(after=JOB_CONFIG_ADAPTED) public static void installDefaultQueueSorter()
      Installs the default queue sorter. Queue(LoadBalancer) is too early to do this