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

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

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


Constructor Summary
DefaultBuildAgent(BuildAgentController buildAgentController, long agentId, java.lang.String agentName)
           
 
Method Summary
 void build(BuildContext buildContext, ReadOnlyCapabilitySet agentCapabilities)
          Executes the passed BuildContext
 void 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 resetErrors()
          Resetes the error count
 void start()
          Starts the build agent
 void stop()
          Stops the build agent immedaitely.
 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,
                         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

build

public void build(@NotNull
                  BuildContext buildContext,
                  @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

cancelBuild

public void 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 immedaitely. Cancelling all currently running builds

Specified by:
stop in interface ExecutableBuildAgent

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 © 2010 Atlassian. All Rights Reserved.