@ThreadSafe public class DefaultBuildAgent extends Object implements ExecutableBuildAgent
Constructor and Description |
---|
DefaultBuildAgent(BuildAgentController buildAgentController,
BuildLoggerManager buildLoggerManager,
long agentId,
String agentName,
String agentDescription)
Deprecated.
since 5.10, use
DefaultBuildAgent(long, String, String) |
DefaultBuildAgent(long agentId,
String agentName,
String agentDescription) |
Modifier and Type | Method and Description |
---|---|
void |
build(ReadOnlyCapabilitySet agentCapabilities,
DockerContainerController dockerContainerController)
Executes the passed
CommonContext |
boolean |
cancelBuild(String buildResultKey)
Cancels the passed buildResultKey if it matches
|
int |
compareTo(BuildAgent o) |
void |
disable() |
void |
enable() |
boolean |
equals(Object o) |
<V> V |
executeWithCurrentContext(Callable<V> callable)
Execute with guarantee that context will not be switched during execution.
|
AgentStatus |
getAgentStatus() |
CommonContext |
getBuilding()
Gets the
BuildContext related to the build that is building on the agent. |
String |
getDescription()
Agent description
|
long |
getId()
Agent id
|
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() |
protected void |
onBetweenBuilds() |
void |
onBuildProcessingFinished()
This method is called when the build process is completed and the result processing has finished.
|
void |
onContextReceived()
This method is called when the agent has just retrieved a context from queue
|
protected void |
onMainThreadEnd() |
void |
resetErrors()
Resetes the error count
|
void |
setContextToBuild(CommonContext newContext) |
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.
|
public DefaultBuildAgent(long agentId, String agentName, @Nullable String agentDescription)
@Deprecated public DefaultBuildAgent(BuildAgentController buildAgentController, BuildLoggerManager buildLoggerManager, long agentId, String agentName, @Nullable String agentDescription)
DefaultBuildAgent(long, String, String)
public long getId()
ExecutableBuildAgent
getId
in interface ExecutableBuildAgent
public String getName()
ExecutableBuildAgent
getName
in interface ExecutableBuildAgent
@NotNull public String getDescription()
ExecutableBuildAgent
getDescription
in interface ExecutableBuildAgent
public void start()
ExecutableBuildAgent
start
in interface ExecutableBuildAgent
protected void onBetweenBuilds()
protected void onMainThreadEnd()
public void build(@NotNull ReadOnlyCapabilitySet agentCapabilities, @NotNull DockerContainerController dockerContainerController) throws Exception
ExecutableBuildAgent
CommonContext
build
in interface ExecutableBuildAgent
Exception
public void onBuildProcessingFinished()
ExecutableBuildAgent
onBuildProcessingFinished
in interface ExecutableBuildAgent
public void onContextReceived()
ExecutableBuildAgent
onContextReceived
in interface ExecutableBuildAgent
public boolean cancelBuild(@NotNull String buildResultKey)
ExecutableBuildAgent
cancelBuild
in interface ExecutableBuildAgent
public <V> V executeWithCurrentContext(Callable<V> callable) throws Exception
ExecutableBuildAgent
executeWithCurrentContext
in interface ExecutableBuildAgent
Exception
public void waitForStop(int secondsToWait) throws TimeoutException
ExecutableBuildAgent
waitForStop
in interface ExecutableBuildAgent
secondsToWait
- -TimeoutException
public int incrementError()
ExecutableBuildAgent
incrementError
in interface ExecutableBuildAgent
public void resetErrors()
ExecutableBuildAgent
resetErrors
in interface ExecutableBuildAgent
public boolean isCancelling()
public void stop()
ExecutableBuildAgent
stop
in interface ExecutableBuildAgent
protected void shutdown()
public void stopNicely()
ExecutableBuildAgent
stopNicely
in interface ExecutableBuildAgent
@Nullable public CommonContext getBuilding()
ExecutableBuildAgent
BuildContext
related to the build that is building on the agent. Null if not building or
cancelling anything.getBuilding
in interface ExecutableBuildAgent
public void setContextToBuild(@NotNull CommonContext newContext)
setContextToBuild
in interface ExecutableBuildAgent
public void enable()
public void disable()
public boolean isEnabled()
public AgentStatus getAgentStatus()
getAgentStatus
in interface ExecutableBuildAgent
public boolean isStopping()
public boolean isActive()
isActive
in interface ExecutableBuildAgent
public int compareTo(BuildAgent o)
Copyright © 2019 Atlassian Software Systems Pty Ltd. All rights reserved.