Class AgentContext
java.lang.Object
com.atlassian.bamboo.agent.bootstrap.AgentContext
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final int
static final String
static final String
static final String
static final String
static final String
Server poll interval for authentication, in seconds.static final String
static final String
static final String
-
Constructor Summary
ConstructorDescriptionAgentContext
(RemoteAgentHttpClientFactory httpClientFactory, @NotNull URL baseUrl, String fingerPrintRequestSuffix, AgentType agentBootstrapType, @Nullable String securityToken) AgentContext
(RemoteAgentHttpClientFactory httpClientFactory, @NotNull URL baseUrl, String fingerPrintRequestSuffix, AgentType agentBootstrapType, @Nullable String securityToken, @Nullable String forKey) -
Method Summary
Modifier and TypeMethodDescriptionstatic String
addParameter
(String url, String name, String value) protected String
createFingerprintUrl
(String hostName) getAbsoluteUrl
(String relativeUrl) getAbsoluteURL
(String relativeUrl) Deprecated.since 6.1, provided for compatibility with old code only@NotNull UUID
Unique ID for authenticating the agent.org.apache.http.client.HttpClient
long
A has identifying last restart of Bamboo server.A hash identifying Bamboo server.void
Set agent in "heart attack" state.boolean
Checks if this remote agent is in "heart attack" currently.boolean
Checks if this remote agent was "heart attack" state at any point in time.void
Clear the 'heart attack' state.protected void
run()
static void
systemExit
(@Nullable String reason, @Nullable Throwable throwable) Shutdown theAgentContext
, as a unrecoverable error has occurred.
-
Field Details
-
SERVER_AUTH_POLL_INTERVAL
Server poll interval for authentication, in seconds.- See Also:
-
SERVER_FINGERPRINT_PARAM
- See Also:
-
INSTANCE_FINGERPRINT_PARAM
- See Also:
-
VERSION_PARAM
- See Also:
-
UUID_PARAM
- See Also:
-
AGENT_ID_PARAM
- See Also:
-
AGENT_FOR_KEY_PARAM
- See Also:
-
SECURITY_TOKEN_PARAM
- See Also:
-
DISABLE_BOOTSTRAP_UPDATE
- See Also:
-
APPROVAL_REQUIRED_HEADER
- See Also:
-
BOOTSTRAP_VERSION
- See Also:
-
BOOTSTRAP_UPDATE_REQUIRED_EXIT_CODE
public static final int BOOTSTRAP_UPDATE_REQUIRED_EXIT_CODE- See Also:
-
-
Constructor Details
-
AgentContext
public AgentContext(RemoteAgentHttpClientFactory httpClientFactory, @NotNull @NotNull URL baseUrl, String fingerPrintRequestSuffix, AgentType agentBootstrapType, @Nullable @Nullable String securityToken) throws MalformedURLException - Throws:
MalformedURLException
-
AgentContext
public AgentContext(RemoteAgentHttpClientFactory httpClientFactory, @NotNull @NotNull URL baseUrl, String fingerPrintRequestSuffix, AgentType agentBootstrapType, @Nullable @Nullable String securityToken, @Nullable @Nullable String forKey) throws MalformedURLException - Throws:
MalformedURLException
-
-
Method Details
-
run
- Throws:
IOException
-
createFingerprintUrl
-
getServerFingerprint
A hash identifying Bamboo server. If it matches, agent can send messages to server. -
getInstanceFingerprint
public long getInstanceFingerprint()A has identifying last restart of Bamboo server. Used to determine if bamboo agent should restart itself. -
getBaseUrl
- Returns:
- base url for bootstrap
- Since:
- 3.3
-
getAbsoluteURL
Deprecated.since 6.1, provided for compatibility with old code only -
getAbsoluteUrl
-
addParameter
-
getHttpClient
public org.apache.http.client.HttpClient getHttpClient() -
getUserProperties
-
getAgentBootstrapType
- Returns:
- type of agent bootstrap
- Since:
- 3.3
-
getAgentUuid
Unique ID for authenticating the agent.- Returns:
- unique agent ID
-
systemExit
public static void systemExit(@Nullable @Nullable String reason, @Nullable @Nullable Throwable throwable) Shutdown the
AgentContext
, as a unrecoverable error has occurred.- Parameters:
reason
- for systemExitthrowable
- TheThrowable
that caused the systemExit.
-
isUnhealthy
public boolean isUnhealthy()Checks if this remote agent was "heart attack" state at any point in time. "Heart attack" state means that heartbeat timeout has been exceeded, but the agent is still running with limited functionality in order to give itself a chance of finishing current build/deployment and returning its result should the communication be re-established. Agent that went through "heart attack" state will attempt to restart itself at the nearest opportunity. -
isHeartAttack
public boolean isHeartAttack()Checks if this remote agent is in "heart attack" currently. "Heart attack" state means that heartbeat timeout has been exceeded, but the agent is still running with limited functionality in order to give itself a chance of finishing current build/deployment and returning its result should the communication be re-established. -
heartAttack
public void heartAttack()Set agent in "heart attack" state. -
normalSinusRhythm
public void normalSinusRhythm()Clear the 'heart attack' state. This does not mean agent is considered healthy, it just means it's not dying right now. If unhealthy, it will be restarted at the nearest opportunity.
-