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

All Superinterfaces:
AgentQueueAccessor
All Known Implementing Classes:
BuildQueueManagerImpl

@Internal
@ThreadSafe
public interface BuildQueueManager
extends AgentQueueAccessor

This interface defines the work that the queue manager can do. Implementors must be threadsafe.


Nested Class Summary
static class BuildQueueManager.QueuedResultKey
           
static class BuildQueueManager.QueueItemView<T>
           
 
Field Summary
static String DISABLE_BUILD_SYSTEM_PROPERTY
           
 
Method Summary
 void addToQueue(CommonContext context)
          Attempts to add the build to a queue.
 Iterable<CommonContext> getBuildQueue()
          Deprecated. since 5.1
 Iterable<BuildQueueManager.QueuedResultKey> getQueuedExecutables()
           
 BuildQueuePosition getQueuePosition(ResultKey resultKey)
          Returns information on position of plan result in the queue.
 com.google.common.collect.ImmutableList<CommonContext> getRecentBuildQueue()
          Deprecated. since 5.1 use getBuildQueue() instead
 void invalidateExecutors(Key planKey)
           
 void invalidateExecutors(String reason)
           
 BuildQueueManager.QueueItemView<CommonContext> peekContext(ResultKey resultKey)
          Returns a queued CommonContext for given resultKey.
 void removeAllBuildsForPlanFromQueue(PlanKey planKey)
          Deprecated. since 5.5 use QueueManagerUtils.removeFromQueue(BuildQueueManager, com.atlassian.bamboo.Key)
 void removeBuildFromQueue(ResultKey resultKey)
          Removes the CommonContext associated with the resultKey to be removed from the queue.
 void reorderBuildInQueue(String planKey, int index)
          Deprecated. since 5.5 use reorderInQueue(com.atlassian.bamboo.ResultKey, int) instead
 boolean reorderBuildInQueue(String buildResultKey, String prevBuildResultKey, String nextBuildResultKey)
          Deprecated. since 5.5 use reorderInQueue(com.atlassian.bamboo.ResultKey, int)
 boolean reorderInQueue(ResultKey resultKey, int index)
          Reorders the build queue.
 void restoreState(Set<ResultKey> resultsToRestore)
          Restore state after server restart.
 
Methods inherited from interface com.atlassian.bamboo.v2.build.queue.AgentQueueAccessor
takeBuildContext
 

Field Detail

DISABLE_BUILD_SYSTEM_PROPERTY

static final String DISABLE_BUILD_SYSTEM_PROPERTY
See Also:
Constant Field Values
Method Detail

addToQueue

void addToQueue(@NotNull
                CommonContext context)
Attempts to add the build to a queue. A BuildQueuedEvent is fired if queuing was successful and a BuildRejectedFromQueueEvent iif rejected.

A lock on the build is obtained from the BuildExecutionManager.

Parameters:
context - @NotNull

removeBuildFromQueue

void removeBuildFromQueue(@NotNull
                          ResultKey resultKey)
Removes the CommonContext associated with the resultKey to be removed from the queue. A BuildDeQueuedEvent is fired.

The lock on the build is not released. The caller should call BuildExecutionManager#finishProcess to release this lock when ready.

Parameters:
resultKey -

peekContext

@Nullable
BuildQueueManager.QueueItemView<CommonContext> peekContext(@NotNull
                                                                    ResultKey resultKey)
Returns a queued CommonContext for given resultKey. Consider using for your build queue viewing needs

Parameters:
resultKey -
Returns:

removeAllBuildsForPlanFromQueue

@Deprecated
void removeAllBuildsForPlanFromQueue(@NotNull
                                                PlanKey planKey)
Deprecated. since 5.5 use QueueManagerUtils.removeFromQueue(BuildQueueManager, com.atlassian.bamboo.Key)

Removes all the CommonContext associated with the planKey to be removed from the queue. A BuildDeQueuedEvent is fired.

The lock on the build is not released. The caller should call BuildExecutionManager#finishProcess to release this lock when ready.

Parameters:
planKey -

reorderBuildInQueue

@Deprecated
void reorderBuildInQueue(String planKey,
                                    int index)
Deprecated. since 5.5 use reorderInQueue(com.atlassian.bamboo.ResultKey, int) instead

Reorders the build queue. CommonContext associated with the planKey is moved to new position in the queue indicated by the zero-based index parameter. If index is < 0 or >= size of queue then CommonContext is positioned at the beginning or at the end of the queue respectively.

Parameters:
planKey - Plan key of the build that shall be repositioned in the queue.
index - New position of a CommonContext associated with the planKey in the queue.

reorderInQueue

boolean reorderInQueue(ResultKey resultKey,
                       int index)
Reorders the build queue. CommonContext associated with the resultKey is moved to new position in the queue indicated by the zero-based index parameter. If index is < 0 or >= size of queue then CommonContext is positioned at the beginning or at the end of the queue respectively.

Parameters:
resultKey - Result key of the build that shall be repositioned in the queue.
index - New position of a CommonContext associated with the planKey in the queue.

reorderBuildInQueue

@Deprecated
@TestOnly
boolean reorderBuildInQueue(@NotNull
                                                String buildResultKey,
                                                @Nullable
                                                String prevBuildResultKey,
                                                @Nullable
                                                String nextBuildResultKey)
Deprecated. since 5.5 use reorderInQueue(com.atlassian.bamboo.ResultKey, int)

Moves a given build in a queue in between two given builds. Required because: - By the time a user requests a reorder that plan may already have shifted up the queue (possibly by a considerable number of positions) thus it may be that be reordering to position 3 your may have actually pushed it down the queue rather than up where you wanted it. By reordering between two plans on the queue you basically eliminate this problem. - It allows us to check that the target position of the queue is as the user expects, so we can detect if there was a queue repositioning clash (by another user reordering the queue remotely).

You must specify buildResultKey and either prevBuildResultKey or nextBuildResultKey (or both).

Parameters:
buildResultKey -
prevBuildResultKey -
nextBuildResultKey -
Returns:
true if queue has been successfully reordered and false otherwise (e.g. previous and next builds were not adjacent)

getQueuePosition

@NotNull
BuildQueuePosition getQueuePosition(@NotNull
                                            ResultKey resultKey)
Returns information on position of plan result in the queue.

Parameters:
resultKey - identifies plan result
Returns:
the [@link BuildQueuePosition} object

invalidateExecutors

void invalidateExecutors(@NotNull
                         String reason)

invalidateExecutors

void invalidateExecutors(@NotNull
                         Key planKey)

getQueuedExecutables

@NotNull
Iterable<BuildQueueManager.QueuedResultKey> getQueuedExecutables()
Returns:
the currently queued executables.

getRecentBuildQueue

@NotNull
@Deprecated
com.google.common.collect.ImmutableList<CommonContext> getRecentBuildQueue()
Deprecated. since 5.1 use getBuildQueue() instead

Returns a list of CommonContext objects currently in the build queue. If there are any pending queue operations, this method will return the latest known queue state.

Returns:
List of CommonContext. Changes to this List is not reflected in the queue.

getBuildQueue

@NotNull
@Deprecated
Iterable<CommonContext> getBuildQueue()
Deprecated. since 5.1

Returns a list of CommonContext objects currently in the build queue. If there are any pending queue operations, this method will return the latest known queue state. Consider using for queue access

Returns:
List of CommonContext. Changes to this List is not reflected in the queue.

restoreState

void restoreState(Set<ResultKey> resultsToRestore)
Restore state after server restart.

Parameters:
resultsToRestore - keys of results that it makes sense to restore


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