com.atlassian.bamboo.v2.build.queue
Interface ExecutableOrderProvider

All Known Implementing Classes:
FifoExecutableOrderProvider

public interface ExecutableOrderProvider

Classes implementing this interface provide ordering for the executables in queue. Implementers should not store any CommonContext inside instances of Provider.


Method Summary
 ResultKey findExecutableForAgent(long agentId, Collection<QueueOfExecutables.ExecutableData> executableData)
          From the list of executables, returns the executable that should be picked up by the agent.
 Iterable<BuildQueueManager.QueuedResultKey> getOrderedExecutables()
          Returns a full list of result keys of queued executables ordered with a global ordering.
 void onDequeue(CommonContext resultKey)
          Called when a context is removed from queue.
 void onEnqueue(Iterable<CommonContext> contexts)
          Will not be called concurrently.
 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

void onEnqueue(@NotNull
               Iterable<CommonContext> contexts)
Will not be called concurrently. Called when new context are added to the queue.


onDequeue

void onDequeue(@NotNull
               CommonContext resultKey)
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.

Parameters:
resultKey -

findExecutableForAgent

@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. Returns null when there none of the supplied executables is suitable.


getOrderedExecutables

@NotNull
Iterable<BuildQueueManager.QueuedResultKey> getOrderedExecutables()
Returns a full list of result keys of queued executables ordered with a global ordering.

Returns:
the returned iterable has to be thread safe.

reorder

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. Can be ignored. Has to be thread safe, will not be mutexed with enq/deq.

Returns:
true if the executable has successfully been moved, false otherwise.


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.