Class FifoExecutableOrderProvider
- java.lang.Object
-
- com.atlassian.bamboo.v2.build.queue.order.FifoExecutableOrderProvider
-
- All Implemented Interfaces:
ExecutableOrderProvider
public class FifoExecutableOrderProvider extends Object implements ExecutableOrderProvider
Basic order provider that implements a reorderable FIFO ordering.
-
-
Constructor Summary
Constructors Constructor Description FifoExecutableOrderProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable ResultKeyfindExecutableForAgent(long agentId, @NotNull Collection<QueueOfExecutables.ExecutableData> executableData)From the list of executables, returns the executable that should be picked up by the agent.@NotNull Collection<BuildQueueManager.QueuedResultKey>getOrderedExecutables()Returns a full list of result keys of queued executables ordered with a global ordering.voidonDequeue(@NotNull CommonContext context)Called when a context is removed from queue.voidonEnqueue(@NotNull Iterable<CommonContext> contexts)Will not be called concurrently.voidremoveByKey(ResultKey resultKey)Remove items with aResultKey.booleanreorder(ResultKey resultKey, int index)Called when an executable with a specific result key should be moved to a specific index in the queue.
-
-
-
Method Detail
-
onEnqueue
public void onEnqueue(@NotNull @NotNull Iterable<CommonContext> contexts)Description copied from interface:ExecutableOrderProviderWill not be called concurrently. Called when new context are added to the queue.- Specified by:
onEnqueuein interfaceExecutableOrderProvider
-
onDequeue
public void onDequeue(@NotNull @NotNull CommonContext context)Description copied from interface:ExecutableOrderProviderCalled when a context is removed from queue. It may be manually removed from queue (stopped), or sent to and acknowledged by an agent. Will not be called concurrently.- Specified by:
onDequeuein interfaceExecutableOrderProvider
-
findExecutableForAgent
@Nullable public @Nullable ResultKey findExecutableForAgent(long agentId, @NotNull @NotNull Collection<QueueOfExecutables.ExecutableData> executableData)
Description copied from interface:ExecutableOrderProviderFrom the list of executables, returns the executable that should be picked up by the agent. Returns null when there none of the supplied executables is suitable.- Specified by:
findExecutableForAgentin interfaceExecutableOrderProvider
-
getOrderedExecutables
@NotNull public @NotNull Collection<BuildQueueManager.QueuedResultKey> getOrderedExecutables()
Description copied from interface:ExecutableOrderProviderReturns a full list of result keys of queued executables ordered with a global ordering.- Specified by:
getOrderedExecutablesin interfaceExecutableOrderProvider- Returns:
- the returned iterable has to be thread safe.
-
reorder
public boolean reorder(ResultKey resultKey, int index)
Description copied from interface:ExecutableOrderProviderCalled when an executable with a specific result key should be moved to a specific index in the queue. Can be ignored. Has to be thread safe, will not be mutexed with enq/deq.- Specified by:
reorderin interfaceExecutableOrderProvider- Returns:
- true if the executable has successfully been moved, false otherwise.
-
removeByKey
public void removeByKey(ResultKey resultKey)
Description copied from interface:ExecutableOrderProviderRemove items with aResultKey. Called if Bamboo detects that order provider contains references to items that are no longer accessible.- Specified by:
removeByKeyin interfaceExecutableOrderProvider
-
-