Package jenkins.advancedqueue.sorter
Class SorterStrategy
- java.lang.Object
-
- jenkins.advancedqueue.sorter.SorterStrategy
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<SorterStrategy>
- Direct Known Subclasses:
MultiBucketStrategy
public abstract class SorterStrategy extends Object implements ExtensionPoint, Describable<SorterStrategy>
- Since:
- 2.0
- Author:
- Magnus Sandberg
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Constructor Summary
Constructors Constructor Description SorterStrategy()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static ExtensionList<SorterStrategy>
all()
All registeredSorterStrategy
s.static List<SorterStrategyDescriptor>
getAllSorterStrategies()
abstract int
getDefaultPriority()
Gets a default priority bucket to be used.SorterStrategyDescriptor
getDescriptor()
abstract int
getNumberOfPriorities()
Gets number of priority buckets to be used.static SorterStrategy
getPrioritySorterStrategy(SorterStrategyDescriptor sorterStrategy)
static SorterStrategyDescriptor
getSorterStrategy(String key)
void
onCanceledItem(Queue.LeftItem item)
Called when aItem
leaves the queue and it is canceled.abstract SorterStrategyCallback
onNewItem(Queue.Item item, SorterStrategyCallback weightCallback)
Called when a newItem
enters the queue.void
onStartedItem(Queue.LeftItem item, float weight)
Called when aItem
leaves the queue and it is started.
-
-
-
Method Detail
-
getDescriptor
public SorterStrategyDescriptor getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<SorterStrategy>
-
onNewItem
public abstract SorterStrategyCallback onNewItem(@NonNull Queue.Item item, SorterStrategyCallback weightCallback)
Called when a newItem
enters the queue.- Parameters:
item
- theQueue.WaitingItem
orBuildableItem
that enters the queueweightCallback
- the callback holds the priority to use anded the called method must set the weight before returning- Returns:
- the
SorterStrategyCallback
provided to the call must be returned
-
onStartedItem
public void onStartedItem(@NonNull Queue.LeftItem item, float weight)
Called when aItem
leaves the queue and it is started.- Parameters:
item
- theQueue.LeftItem
weight
- the weight assigned when the item entered the queue
-
onCanceledItem
public void onCanceledItem(@NonNull Queue.LeftItem item)
Called when aItem
leaves the queue and it is canceled.
-
getNumberOfPriorities
public abstract int getNumberOfPriorities()
Gets number of priority buckets to be used.
-
getDefaultPriority
public abstract int getDefaultPriority()
Gets a default priority bucket to be used.
-
getAllSorterStrategies
public static List<SorterStrategyDescriptor> getAllSorterStrategies()
-
getSorterStrategy
@CheckForNull public static SorterStrategyDescriptor getSorterStrategy(String key)
-
getPrioritySorterStrategy
@CheckForNull public static SorterStrategy getPrioritySorterStrategy(SorterStrategyDescriptor sorterStrategy)
-
all
public static ExtensionList<SorterStrategy> all()
All registeredSorterStrategy
s.
-
-