com.atlassian.bamboo.v2.build.agent
Class DefaultBuildAgent

java.lang.Object
  extended by com.atlassian.bamboo.v2.build.agent.DefaultBuildAgent
All Implemented Interfaces:
ExecutableBuildAgent
Direct Known Subclasses:
RemoteBuildAgent

@ThreadSafe
public class DefaultBuildAgent
extends java.lang.Object
implements ExecutableBuildAgent


Constructor Summary
DefaultBuildAgent(BuildAgentController buildAgentController, BuildLoggerManager buildLoggerManager, long agentId, java.lang.String agentName)
           
 
Method Summary
 void build(BuildContext newBuildContext, ReadOnlyCapabilitySet agentCapabilities)
          Executes the passed BuildContext
 boolean cancelBuild(java.lang.String buildResultKey)
          Cancels the passed buildResultKey if it matches
 int compareTo(BuildAgent o)
           
 void disable()
           
 void enable()
           
 boolean equals(java.lang.Object o)
           
 AgentStatus getAgentStatus()
           
 BuildContext getBuilding()
          Gets the BuildContext related to the build that is building on the agent.
 long getId()
          Agent id
 java.lang.String getName()
          Agent name
 int hashCode()
           
 int incrementError()
          Tells the agent that an unhandled error has occurred.
 boolean isActive()
           
 boolean isCancelling()
           
 boolean isEnabled()
           
 boolean isStopping()
           
 void onBuildProcessingFinished()
          This method is called when the build process is completed and the result processing has finished.
protected  void onMainThreadFinished()
           
 void resetErrors()
          Resetes the error count
protected  void shutdown()
           
 void start()
          Starts the build agent
 void stop()
          Stops the build agent immediately.
 void stopNicely()
          Attempt to stop the agent and wait for the current build (if any) to stop building
 void waitForStop(int secondsToWait)
          Waits a certain number of seconds for a build to stop.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultBuildAgent

public DefaultBuildAgent(BuildAgentController buildAgentController,
                         BuildLoggerManager buildLoggerManager,
                         long agentId,
                         java.lang.String agentName)
Method Detail

getId

public long getId()
Description copied from interface: ExecutableBuildAgent
Agent id

Specified by:
getId in interface ExecutableBuildAgent
Returns:

getName

public java.lang.String getName()
Description copied from interface: ExecutableBuildAgent
Agent name

Specified by:
getName in interface ExecutableBuildAgent
Returns:

start

public void start()
Description copied from interface: ExecutableBuildAgent
Starts the build agent

Specified by:
start in interface ExecutableBuildAgent

onMainThreadFinished

protected void onMainThreadFinished()

build

public void build(@NotNull
                  BuildContext newBuildContext,
                  @NotNull
                  ReadOnlyCapabilitySet agentCapabilities)
           throws java.lang.Exception
Description copied from interface: ExecutableBuildAgent
Executes the passed BuildContext

Specified by:
build in interface ExecutableBuildAgent
Throws:
java.lang.Exception

onBuildProcessingFinished

public void onBuildProcessingFinished()
Description copied from interface: ExecutableBuildAgent
This method is called when the build process is completed and the result processing has finished.

Specified by:
onBuildProcessingFinished in interface ExecutableBuildAgent

cancelBuild

public boolean cancelBuild(@NotNull
                           java.lang.String buildResultKey)
Description copied from interface: ExecutableBuildAgent
Cancels the passed buildResultKey if it matches

Specified by:
cancelBuild in interface ExecutableBuildAgent

waitForStop

public void waitForStop(int secondsToWait)
                 throws java.util.concurrent.TimeoutException
Description copied from interface: ExecutableBuildAgent
Waits a certain number of seconds for a build to stop.

Specified by:
waitForStop in interface ExecutableBuildAgent
Parameters:
secondsToWait - -
Throws:
java.util.concurrent.TimeoutException

incrementError

public int incrementError()
Description copied from interface: ExecutableBuildAgent
Tells the agent that an unhandled error has occurred. The agent may then choose to stop the error if a thredhold has been reached. Provides an overload of exceptions being thrown.

Specified by:
incrementError in interface ExecutableBuildAgent
Returns:

resetErrors

public void resetErrors()
Description copied from interface: ExecutableBuildAgent
Resetes the error count

Specified by:
resetErrors in interface ExecutableBuildAgent

isCancelling

public boolean isCancelling()

stop

public void stop()
Description copied from interface: ExecutableBuildAgent
Stops the build agent immediately. Cancelling all currently running builds

Specified by:
stop in interface ExecutableBuildAgent

shutdown

protected void shutdown()

stopNicely

public void stopNicely()
Description copied from interface: ExecutableBuildAgent
Attempt to stop the agent and wait for the current build (if any) to stop building

Specified by:
stopNicely in interface ExecutableBuildAgent

getBuilding

public BuildContext getBuilding()
Description copied from interface: ExecutableBuildAgent
Gets the BuildContext related to the build that is building on the agent. Null if not building or cancelling anything.

Specified by:
getBuilding in interface ExecutableBuildAgent
Returns:

enable

public void enable()

disable

public void disable()

isEnabled

public boolean isEnabled()

getAgentStatus

public AgentStatus getAgentStatus()
Specified by:
getAgentStatus in interface ExecutableBuildAgent

isStopping

public boolean isStopping()

isActive

public boolean isActive()
Specified by:
isActive in interface ExecutableBuildAgent

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(BuildAgent o)


Copyright © 2012 Atlassian. All Rights Reserved.