Class AgentQueueAccessorImpl
java.lang.Object
com.atlassian.bamboo.v2.build.queue.AgentQueueAccessorImpl
- All Implemented Interfaces:
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
-
Method Summary
Modifier and TypeMethodDescription@Nullable CommonContext
takeBuildContext
(long id) Takes aCommonContext
from the queue, blocking until one is available.takeContext
(long agentId) Takes aCommonContext
from the queue, blocking until one is available.takeContext
(long agentId, @Nullable ResultKey resultKey) If resultKey is not null, takes a specificCommonContext
from the queue or nothing if there's no job with specified key in the queue.
-
Constructor Details
-
AgentQueueAccessorImpl
public AgentQueueAccessorImpl()
-
-
Method Details
-
takeBuildContext
Description copied from interface:AgentQueueAccessor
Takes aCommonContext
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.- Specified by:
takeBuildContext
in 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 callingThread
is interrupted.
-
takeContext
Description copied from interface:AgentQueueAccessor
Takes aCommonContext
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.- Specified by:
takeContext
in interfaceAgentQueueAccessor
- Parameters:
agentId
- the id of the agent that is taking the build context.- Returns:
- The
AgentQueueAccessor.QueueAccessResult
containing:CommonContext
on success, error message on error, nulls in case of timeout on retrieval. - Throws:
InterruptedException
- if the callingThread
is interrupted.
-
takeContext
public AgentQueueAccessor.QueueAccessResult takeContext(long agentId, @Nullable @Nullable ResultKey resultKey) throws InterruptedException Description copied from interface:AgentQueueAccessor
If resultKey is not null, takes a specificCommonContext
from 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:
takeContext
in 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.QueueAccessResult
containing:CommonContext
on success, error message on error, nulls in case of timeout on retrieval. - Throws:
InterruptedException
- if the callingThread
is interrupted.
-