com.atlassian.bamboo.build
Interface BuildExecutionManager

All Superinterfaces:
BuildExecutionUpdateManager, BuildLoggerManager
All Known Implementing Classes:
DefaultBuildExecutionManager

@ThreadSafe
public interface BuildExecutionManager
extends BuildExecutionUpdateManager

A class that is aware of all the goings on in executing builds.


Nested Class Summary
static interface BuildExecutionManager.BuildDetectionAction
          Callback action interface used by tryToDetectAndBuild method.
 
Field Summary
static long DEFAULT_WAITTIME
           
 
Method Summary
 void finishBuild(java.lang.String planKey)
          Calls removeCurrentlyBuilding & finishProcess
 void finishProcess(java.lang.String buildKey)
          Unmark the build for processing
 CurrentlyBuilding getBuildRunningOnAgent(java.lang.Long buildAgentId)
           
 CurrentlyBuilding getCurrentlyBuilding(java.lang.String planKey)
           
 java.util.List<CurrentlyBuilding> getCurrentlyExecutingBuilds()
          Retrieves a list of all builds being executed (i.e not just queued).
 boolean isBeingProcessed(java.lang.String buildKey)
          Checks if this buildKey is being actively processed
 CurrentlyBuilding removeCurrentlyBuilding(java.lang.String planKey)
           
 void setCurrentlyBuilding(BuildContext buildContext, java.util.Collection<BuildAgent> executableAgents)
          Denotes that the passed build context is beginning the build process.
 void setCurrentlyBuilding(BuildContext buildContext, java.util.Collection<BuildAgent> executableAgents, java.util.Collection<ElasticImageConfiguration> executableImages)
          Denotes that the passed build context is beginning the build process.
 void startManualBuild(Build buildPlan, com.atlassian.user.User user)
           
 boolean tryToBuild(java.lang.String planKey, boolean wait)
          Attempts to build the passed planKey.
 boolean tryToDetectAndBuild(java.lang.String planKey, BuildExecutionManager.BuildDetectionAction buildDetectionAction, boolean waitForProcessLock)
          Wraps up the passed callback BuildExecutionManager.BuildDetectionAction in a process lock, and also a check for currentlyBuilding.
 boolean tryToProcess(java.lang.String buildKey)
          Attempts to gain control to process the build.
 boolean waitToProcess(java.lang.String planKey)
          Attempts to process the plan for up to DEFAULT_WAITTIME time.
 
Methods inherited from interface com.atlassian.bamboo.build.BuildExecutionUpdateManager
setBuildFinish, setBuildRunningOnAgent, setBuildStart
 
Methods inherited from interface com.atlassian.bamboo.build.BuildLoggerManager
getBuildLogger
 

Field Detail

DEFAULT_WAITTIME

static final long DEFAULT_WAITTIME
See Also:
Constant Field Values
Method Detail

isBeingProcessed

boolean isBeingProcessed(@NotNull
                         java.lang.String buildKey)
Checks if this buildKey is being actively processed

Parameters:
buildKey -
Returns:
true if the builds is being processed

tryToProcess

boolean tryToProcess(@NotNull
                     java.lang.String buildKey)
Attempts to gain control to process the build. Returns true if access acquired and false if not successful

Parameters:
buildKey -
Returns:
true to process acquisition successful and false if not

finishProcess

void finishProcess(@NotNull
                   java.lang.String buildKey)
Unmark the build for processing

Parameters:
buildKey -

getCurrentlyExecutingBuilds

java.util.List<CurrentlyBuilding> getCurrentlyExecutingBuilds()
Retrieves a list of all builds being executed (i.e not just queued).

Returns:

getCurrentlyBuilding

@Nullable
CurrentlyBuilding getCurrentlyBuilding(@NotNull
                                                java.lang.String planKey)

removeCurrentlyBuilding

@Nullable
CurrentlyBuilding removeCurrentlyBuilding(java.lang.String planKey)

waitToProcess

boolean waitToProcess(java.lang.String planKey)
Attempts to process the plan for up to DEFAULT_WAITTIME time. You can force the method to abort and return by calling Thread.interrupt()

Parameters:
planKey -
Returns:
true if the "lock" has been obtianed, false if not

setCurrentlyBuilding

void setCurrentlyBuilding(@NotNull
                          BuildContext buildContext,
                          @NotNull
                          java.util.Collection<BuildAgent> executableAgents,
                          @NotNull
                          java.util.Collection<ElasticImageConfiguration> executableImages)
Denotes that the passed build context is beginning the build process. (i.e. it's being queued)

Parameters:
buildContext - -
executableAgents - - a list of agents on which this build can be run.
executableImages - - a list of images on which the build can be run.

setCurrentlyBuilding

void setCurrentlyBuilding(@NotNull
                          BuildContext buildContext,
                          @NotNull
                          java.util.Collection<BuildAgent> executableAgents)
Denotes that the passed build context is beginning the build process. (i.e. it's being queued)

Parameters:
buildContext -
executableAgents - - a list of agents on which this build can be run.

getBuildRunningOnAgent

CurrentlyBuilding getBuildRunningOnAgent(@NotNull
                                         java.lang.Long buildAgentId)

tryToBuild

boolean tryToBuild(@NotNull
                   java.lang.String planKey,
                   boolean wait)
Attempts to build the passed planKey. A simple shortcut method that calls #isAllowBuilding(String), getCurrentlyBuilding(String) and tryToProcess(String). If the call returns true, you also have the "lock" on the plan.

Parameters:
planKey -
wait - should it return fast, or wait if can't get the lock
Returns:

finishBuild

void finishBuild(@NotNull
                 java.lang.String planKey)
Calls removeCurrentlyBuilding & finishProcess

Parameters:
planKey -
wait -

tryToDetectAndBuild

boolean tryToDetectAndBuild(java.lang.String planKey,
                            BuildExecutionManager.BuildDetectionAction buildDetectionAction,
                            boolean waitForProcessLock)
Wraps up the passed callback BuildExecutionManager.BuildDetectionAction in a process lock, and also a check for currentlyBuilding. Will fire off BuildTriggeredEvent if the callback completes successfully and a BuildContext is returned by the callback action.

Parameters:
planKey -
buildDetectionAction -
waitForProcessLock -
Returns:

startManualBuild

void startManualBuild(Build buildPlan,
                      com.atlassian.user.User user)


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.