public class BuildQueueManagerImpl extends Object implements BuildQueueManager
BuildQueueManager.QueuedResultKey, BuildQueueManager.QueueItemView<T>AgentQueueAccessor.QueueAccessResultDISABLE_BUILD_SYSTEM_PROPERTY| Constructor and Description |
|---|
BuildQueueManagerImpl(@NotNull AgentManager agentManager,
@NotNull com.atlassian.event.api.EventPublisher eventPublisher,
@NotNull BuildExecutionManager buildExecutionManager,
@NotNull com.atlassian.plugin.PluginAccessor pluginAccessor,
@NotNull ErrorUpdateHandler errorUpdateHandler,
@NotNull ExecutableAgentsHelper executableAgentsHelper,
@NotNull CustomVariableContextRunner customVariableContextRunner,
@NotNull ExecutionPhaseService executionPhaseService,
@NotNull XStreamFactory xStreamFactory,
@NotNull org.springframework.transaction.support.TransactionTemplate transactionTemplate,
@NotNull LocalResultProcessor resultProcessor) |
| Modifier and Type | Method and Description |
|---|---|
void |
addToQueue(@NotNull CommonContext context)
Attempts to add the build to a queue.
|
@Nullable Set<Long> |
getExecutorsForQueuedExecutable(@NotNull ResultKey resultKey) |
@Nullable Collection<ElasticImageConfiguration> |
getImagesForQueuedExecutable(@NotNull ResultKey resultKey) |
@NotNull Iterable<BuildQueueManager.QueuedResultKey> |
getQueuedExecutables() |
@NotNull BuildQueuePosition |
getQueuePosition(@NotNull ResultKey resultKey)
Returns information on position of plan result in the queue.
|
void |
invalidateExecutables(@NotNull BuildAgent buildAgent)
Updates all agent-executable mappings for a given agent.
|
void |
invalidateExecutors(@NotNull Key key) |
void |
invalidateExecutors(@NotNull String reason) |
@Nullable BuildQueueManager.QueueItemView<CommonContext> |
peekContext(@NotNull ResultKey resultKey)
Returns a queued CommonContext for given resultKey.
|
void |
removeBuildFromQueue(@NotNull ResultKey resultKey)
Removes the
CommonContext associated with the resultKey to be removed from the queue. |
boolean |
reorderInQueue(ResultKey resultKey,
int index)
Reorders the build queue.
|
void |
restoreState(Set<ResultKey> resultsToRestore)
Restore state after server restart.
|
@Nullable CommonContext |
takeBuildContext(long agentId)
Takes a
CommonContext from the queue, blocking until one is available. |
@Nullable AgentQueueAccessor.QueueAccessResult |
takeContext(long agentId)
Takes a
CommonContext from the queue, blocking until one is available. |
@Inject
public BuildQueueManagerImpl(@NotNull
@NotNull AgentManager agentManager,
@NotNull
@NotNull com.atlassian.event.api.EventPublisher eventPublisher,
@NotNull
@NotNull BuildExecutionManager buildExecutionManager,
@NotNull
@NotNull com.atlassian.plugin.PluginAccessor pluginAccessor,
@NotNull
@NotNull ErrorUpdateHandler errorUpdateHandler,
@NotNull
@NotNull ExecutableAgentsHelper executableAgentsHelper,
@NotNull
@NotNull CustomVariableContextRunner customVariableContextRunner,
@NotNull
@NotNull ExecutionPhaseService executionPhaseService,
@NotNull
@NotNull XStreamFactory xStreamFactory,
@NotNull
@NotNull org.springframework.transaction.support.TransactionTemplate transactionTemplate,
@NotNull
@NotNull LocalResultProcessor resultProcessor)
public void addToQueue(@NotNull
@NotNull CommonContext context)
BuildQueueManager
A lock on the build is obtained from the BuildExecutionManager.
addToQueue in interface BuildQueueManagerpublic void removeBuildFromQueue(@NotNull
@NotNull ResultKey resultKey)
BuildQueueManagerCommonContext associated with the resultKey to be removed from the queue.
The lock on the build is not released. The caller should call com.atlassian.bamboo.build.BuildExecutionManager#finishBuild(PlanResultKey) to
release this lock when ready.
removeBuildFromQueue in interface BuildQueueManagerpublic boolean reorderInQueue(ResultKey resultKey, int index)
BuildQueueManagerCommonContext 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.reorderInQueue in interface BuildQueueManagerresultKey - 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.@NotNull public @NotNull BuildQueuePosition getQueuePosition(@NotNull @NotNull ResultKey resultKey)
BuildQueueManagergetQueuePosition in interface BuildQueueManagerresultKey - identifies plan resultpublic void invalidateExecutors(@NotNull
@NotNull String reason)
invalidateExecutors in interface BuildQueueManagerpublic void invalidateExecutors(@NotNull
@NotNull Key key)
invalidateExecutors in interface BuildQueueManagerpublic void invalidateExecutables(@NotNull
@NotNull BuildAgent buildAgent)
BuildQueueManagerinvalidateExecutables in interface BuildQueueManager@NotNull public @NotNull Iterable<BuildQueueManager.QueuedResultKey> getQueuedExecutables()
getQueuedExecutables in interface BuildQueueManager@Nullable public @Nullable Collection<ElasticImageConfiguration> getImagesForQueuedExecutable(@NotNull @NotNull ResultKey resultKey)
getImagesForQueuedExecutable in interface BuildQueueManager@Nullable public @Nullable Set<Long> getExecutorsForQueuedExecutable(@NotNull @NotNull ResultKey resultKey)
getExecutorsForQueuedExecutable in interface BuildQueueManager@Nullable public @Nullable BuildQueueManager.QueueItemView<CommonContext> peekContext(@NotNull @NotNull ResultKey resultKey)
BuildQueueManagerpeekContext in interface BuildQueueManagerpublic void restoreState(Set<ResultKey> resultsToRestore)
BuildQueueManagerrestoreState in interface BuildQueueManagerresultsToRestore - keys of results that it makes sense to restore@Nullable public @Nullable CommonContext takeBuildContext(long agentId) throws InterruptedException
AgentQueueAccessorCommonContext from the queue, blocking until one is available.
The lock on the build is not released. The caller should call com.atlassian.bamboo.build.BuildExecutionManager#finishBuild(PlanResultKey) to
release this lock when ready.
takeBuildContext in interface AgentQueueAccessoragentId - the id of the agent that is taking the build context.CommonContext, null in case of timeout on retrieval.InterruptedException - if the calling Thread is interrupted.@Nullable public @Nullable AgentQueueAccessor.QueueAccessResult takeContext(long agentId) throws InterruptedException
AgentQueueAccessorCommonContext from the queue, blocking until one is available.
The lock on the build is not released. The caller should call com.atlassian.bamboo.build.BuildExecutionManager#finishBuild(PlanResultKey) to
release this lock when ready.
takeContext in interface AgentQueueAccessoragentId - the id of the agent that is taking the build context.AgentQueueAccessor.QueueAccessResult containing: CommonContext on success, error message on error, nulls in case of timeout on retrieval.InterruptedException - if the calling Thread is interrupted.Copyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.