Class AgentContext

java.lang.Object
com.atlassian.bamboo.agent.bootstrap.AgentContext
All Implemented Interfaces:
Serializable

public class AgentContext extends Object implements Serializable
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • run

      protected void run() throws IOException
      Throws:
      IOException
    • createFingerprintUrl

      protected String createFingerprintUrl(String hostName)
    • getServerFingerprint

      public String 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

      public URL getBaseUrl()
      Returns:
      base url for bootstrap
      Since:
      3.3
    • getAbsoluteURL

      @Deprecated public String getAbsoluteURL(String relativeUrl)
      Deprecated.
      since 6.1, provided for compatibility with old code only
    • getAbsoluteUrl

      public String getAbsoluteUrl(String relativeUrl)
    • addParameter

      public static String addParameter(String url, String name, String value)
    • getHttpClient

      public org.apache.http.client.HttpClient getHttpClient()
    • getUserProperties

      public Map<String,String> getUserProperties()
    • getAgentBootstrapType

      public AgentType getAgentBootstrapType()
      Returns:
      type of agent bootstrap
      Since:
      3.3
    • getAgentUuid

      @NotNull public @NotNull UUID 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 systemExit
      throwable - The Throwable 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.