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
-
Method Summary
Modifier and TypeMethodDescriptionstatic ExtensionList<SorterStrategy>
all()
All registeredSorterStrategy
s.static List<SorterStrategyDescriptor>
abstract int
Gets a default priority bucket to be used.abstract int
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.
-
Constructor Details
-
SorterStrategy
public SorterStrategy()
-
-
Method Details
-
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
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
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
-
getSorterStrategy
-
getPrioritySorterStrategy
@CheckForNull public static SorterStrategy getPrioritySorterStrategy(SorterStrategyDescriptor sorterStrategy) -
all
All registeredSorterStrategy
s.
-