Class AgentQueueAccessorImpl
- java.lang.Object
-
- com.atlassian.bamboo.v2.build.queue.AgentQueueAccessorImpl
-
- All Implemented Interfaces:
AgentQueueAccessor
public class AgentQueueAccessorImpl extends Object implements AgentQueueAccessor
An instance of this class is shared between multiple local agents
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.atlassian.bamboo.v2.build.queue.AgentQueueAccessor
AgentQueueAccessor.QueueAccessResult
-
-
Constructor Summary
Constructors Constructor Description AgentQueueAccessorImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @Nullable CommonContexttakeBuildContext(long id)Takes aCommonContextfrom the queue, blocking until one is available.AgentQueueAccessor.QueueAccessResulttakeContext(long agentId)Takes aCommonContextfrom the queue, blocking until one is available.AgentQueueAccessor.QueueAccessResulttakeContext(long agentId, @Nullable ResultKey resultKey)If resultKey is not null, takes a specificCommonContextfrom the queue or nothing if there's no job with specified key in the queue.
-
-
-
Method Detail
-
takeBuildContext
@Nullable public @Nullable CommonContext takeBuildContext(long id) throws InterruptedException
Description copied from interface:AgentQueueAccessorTakes aCommonContextfrom 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.- Specified by:
takeBuildContextin interfaceAgentQueueAccessor- Parameters:
id- the id of the agent that is taking the build context.- Returns:
- The
CommonContext, null in case of timeout on retrieval. - Throws:
InterruptedException- if the callingThreadis interrupted.
-
takeContext
public AgentQueueAccessor.QueueAccessResult takeContext(long agentId) throws InterruptedException
Description copied from interface:AgentQueueAccessorTakes aCommonContextfrom 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.- Specified by:
takeContextin interfaceAgentQueueAccessor- Parameters:
agentId- the id of the agent that is taking the build context.- Returns:
- The
AgentQueueAccessor.QueueAccessResultcontaining:CommonContexton success, error message on error, nulls in case of timeout on retrieval. - Throws:
InterruptedException- if the callingThreadis interrupted.
-
takeContext
public AgentQueueAccessor.QueueAccessResult takeContext(long agentId, @Nullable @Nullable ResultKey resultKey) throws InterruptedException
Description copied from interface:AgentQueueAccessorIf resultKey is not null, takes a specificCommonContextfrom the queue or nothing if there's no job with specified key in the queue. If resultKey is null, behaved identically toAgentQueueAccessor.takeContext(long).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.- Specified by:
takeContextin interfaceAgentQueueAccessor- Parameters:
agentId- the id of the agent that is taking the build context.resultKey- of the job that agent expects to receive- Returns:
- The
AgentQueueAccessor.QueueAccessResultcontaining:CommonContexton success, error message on error, nulls in case of timeout on retrieval. - Throws:
InterruptedException- if the callingThreadis interrupted.
-
-