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 ResultKey
findExecutableForAgent(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.void
onDequeue(@NotNull CommonContext context)
Called when a context is removed from queue.void
onEnqueue(@NotNull Iterable<CommonContext> contexts)
Will not be called concurrently.void
removeByKey(ResultKey resultKey)
Remove items with aResultKey
.boolean
reorder(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:ExecutableOrderProvider
Will not be called concurrently. Called when new context are added to the queue.- Specified by:
onEnqueue
in interfaceExecutableOrderProvider
-
onDequeue
public void onDequeue(@NotNull @NotNull CommonContext context)
Description copied from interface:ExecutableOrderProvider
Called 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:
onDequeue
in interfaceExecutableOrderProvider
-
findExecutableForAgent
@Nullable public @Nullable ResultKey findExecutableForAgent(long agentId, @NotNull @NotNull Collection<QueueOfExecutables.ExecutableData> executableData)
Description copied from interface:ExecutableOrderProvider
From 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:
findExecutableForAgent
in interfaceExecutableOrderProvider
-
getOrderedExecutables
@NotNull public @NotNull Collection<BuildQueueManager.QueuedResultKey> getOrderedExecutables()
Description copied from interface:ExecutableOrderProvider
Returns a full list of result keys of queued executables ordered with a global ordering.- Specified by:
getOrderedExecutables
in interfaceExecutableOrderProvider
- Returns:
- the returned iterable has to be thread safe.
-
reorder
public boolean reorder(ResultKey resultKey, int index)
Description copied from interface:ExecutableOrderProvider
Called 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:
reorder
in interfaceExecutableOrderProvider
- Returns:
- true if the executable has successfully been moved, false otherwise.
-
removeByKey
public void removeByKey(ResultKey resultKey)
Description copied from interface:ExecutableOrderProvider
Remove items with aResultKey
. Called if Bamboo detects that order provider contains references to items that are no longer accessible.- Specified by:
removeByKey
in interfaceExecutableOrderProvider
-
-