Package com.atlassian.bamboo.v2.build
Class CurrentlyBuildingImpl
- java.lang.Object
-
- com.atlassian.bamboo.v2.build.CurrentlyBuildingImpl
-
- All Implemented Interfaces:
BambooCustomDataAware,ExecutionStatus,CurrentlyBuilding
@ThreadSafe public class CurrentlyBuildingImpl extends Object implements CurrentlyBuilding
-
-
Constructor Summary
Constructors Constructor Description CurrentlyBuildingImpl(BuildIdentifier buildIdentifier, BuildChanges buildChanges, TriggerReason triggerReason, Long averageDuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanabortFinishing()Attempt to stop finishing the build in case of database issues.booleanequals(Object o)@Nullable AgentTypegetAgentType()The current build agent type iff the build is current building on an agent.longgetAverageDuration()Estimated total execution time of a task.@Nullable LonggetBuildAgentId()The current build agent id iff the build is current building on an agent.@Nullable BuildCancelledDetailsgetBuildCancelledDetails()@NotNull BuildChangesgetBuildChanges()Changes associated with current build@Nullable BuildHungDetailsgetBuildHangDetails()Details about the build if it hung.@NotNull BuildIdentifiergetBuildIdentifier()The ID of the buildBuildQueueTimeoutDetailsgetBuildQueueTimeoutDetails()Details about the build if queue timeout was detected.@NotNull Map<String,String>getCustomData()Container for custom datalonggetElapsedTime()How long the task has taken up to now.@NotNull PlanResultKeygetPlanResultKey()@NotNull BuildProgressBargetProgressBar()Because of XStream deserialization we need to lazy initialize buildProgressBar in getter@NotNull DategetQueueTime()TheDatewhen the build was originally queued@Nullable DategetStartTime()When was the execution started.@NotNull TriggerReasongetTriggerReason()The trigger reason of the current build@Nullable DategetVcsUpdateTime()The timeDatewhen updating / checking out source repository beganinthashCode()booleanisCurrentlyQueuedOnly()Is the build queued?booleanisDetachedFromAgent()Was it registered as building on agent, but agent requested another job since?booleanisUpdatingVcs()voidsetAgentType(@Nullable AgentType agentType)Sets the agent typevoidsetBuildAgentId(@Nullable Long buildAgentId)Sets the fact that the build will now be building on an agentvoidsetBuildCancelledDetails(@Nullable BuildCancelledDetails buildCancelledDetails)voidsetBuildHangDetails(@Nullable BuildHungDetails buildHungDetails)Set the details if the build was detected to be hung.voidsetBuildQueueTimeoutDetails(BuildQueueTimeoutDetails buildQueueTimeoutDetails)Sets build queue timeout detailsvoidsetStartTime(long timestamp)Sets the start timestamp of the build.voidsetStopTime(long timestamp)Sets the stop timestamp of the build.voidsetVcsUpdateTime(@NotNull Date vcsUpdateTime)voidstartTimer()Starts an internal timer to the currently running buildvoidstopTimer()Stops the internal timer for the current running buildbooleantryToFinish()Attempt to mark this object for operation requiring exclusive access: i.e.voidupdateCustomDataEntry(@NotNull String key, @NotNull String value)Add or modify key value pair to Object's custom data map.
-
-
-
Constructor Detail
-
CurrentlyBuildingImpl
public CurrentlyBuildingImpl(BuildIdentifier buildIdentifier, BuildChanges buildChanges, TriggerReason triggerReason, Long averageDuration)
-
-
Method Detail
-
getPlanResultKey
@NotNull public @NotNull PlanResultKey getPlanResultKey()
-
getBuildIdentifier
@NotNull public @NotNull BuildIdentifier getBuildIdentifier()
Description copied from interface:ExecutionStatusThe ID of the build- Specified by:
getBuildIdentifierin interfaceExecutionStatus- Returns:
- buildIdentifier
-
getBuildChanges
@NotNull public @NotNull BuildChanges getBuildChanges()
Description copied from interface:ExecutionStatusChanges associated with current build- Specified by:
getBuildChangesin interfaceExecutionStatus- Returns:
- buildChanges
-
getTriggerReason
@NotNull public @NotNull TriggerReason getTriggerReason()
Description copied from interface:ExecutionStatusThe trigger reason of the current build- Specified by:
getTriggerReasonin interfaceExecutionStatus- Returns:
- triggerReason
-
getProgressBar
@NotNull public @NotNull BuildProgressBar getProgressBar()
Because of XStream deserialization we need to lazy initialize buildProgressBar in getter- Specified by:
getProgressBarin interfaceExecutionStatus- Returns:
- progressBar
-
getAverageDuration
public long getAverageDuration()
Description copied from interface:ExecutionStatusEstimated total execution time of a task.- Specified by:
getAverageDurationin interfaceExecutionStatus- Returns:
- long representing estimated execution time - in millis
-
tryToFinish
public boolean tryToFinish()
Description copied from interface:CurrentlyBuildingAttempt to mark this object for operation requiring exclusive access: i.e. finishing build. Return value indicates if current thread is the first to call this method.- Specified by:
tryToFinishin interfaceCurrentlyBuilding- Returns:
- true iff thread is free to request removal of this object
-
abortFinishing
public boolean abortFinishing()
Description copied from interface:CurrentlyBuildingAttempt to stop finishing the build in case of database issues.- Specified by:
abortFinishingin interfaceCurrentlyBuilding- Returns:
- true if there was an attempt to finish the build.
-
getBuildAgentId
@Nullable public @Nullable Long getBuildAgentId()
Description copied from interface:CurrentlyBuildingThe current build agent id iff the build is current building on an agent. This will be null if the build has not been picked up by an agent or the agent handed off the build to the server- Specified by:
getBuildAgentIdin interfaceCurrentlyBuilding- Returns:
- agent's id
-
setBuildAgentId
public void setBuildAgentId(@Nullable @Nullable Long buildAgentId)Description copied from interface:CurrentlyBuildingSets the fact that the build will now be building on an agent- Specified by:
setBuildAgentIdin interfaceCurrentlyBuilding- Parameters:
buildAgentId- agent's id
-
getAgentType
@Nullable public @Nullable AgentType getAgentType()
Description copied from interface:CurrentlyBuildingThe current build agent type iff the build is current building on an agent. This will be null if the build has not been picked up by an agent or the agent handed off the build to the server- Specified by:
getAgentTypein interfaceCurrentlyBuilding- Returns:
- agent's type
-
getCustomData
@NotNull public @NotNull Map<String,String> getCustomData()
Description copied from interface:CurrentlyBuildingContainer for custom data- Specified by:
getCustomDatain interfaceCurrentlyBuilding- Returns:
- map of key-value pairs
-
updateCustomDataEntry
public void updateCustomDataEntry(@NotNull @NotNull String key, @NotNull @NotNull String value)Description copied from interface:BambooCustomDataAwareAdd or modify key value pair to Object's custom data map.- Specified by:
updateCustomDataEntryin interfaceBambooCustomDataAware- Parameters:
key- key to addvalue- value to add
-
setAgentType
public void setAgentType(@Nullable @Nullable AgentType agentType)Description copied from interface:CurrentlyBuildingSets the agent type- Specified by:
setAgentTypein interfaceCurrentlyBuilding- Parameters:
agentType- agent's type
-
isCurrentlyQueuedOnly
public boolean isCurrentlyQueuedOnly()
Description copied from interface:CurrentlyBuildingIs the build queued?- Specified by:
isCurrentlyQueuedOnlyin interfaceCurrentlyBuilding- Returns:
-
isDetachedFromAgent
public boolean isDetachedFromAgent()
Description copied from interface:CurrentlyBuildingWas it registered as building on agent, but agent requested another job since?- Specified by:
isDetachedFromAgentin interfaceCurrentlyBuilding
-
getStartTime
@Nullable public @Nullable Date getStartTime()
Description copied from interface:ExecutionStatusWhen was the execution started.- Specified by:
getStartTimein interfaceExecutionStatus- Returns:
- Date - when the execution started
-
getQueueTime
@NotNull public @NotNull Date getQueueTime()
Description copied from interface:CurrentlyBuildingTheDatewhen the build was originally queued- Specified by:
getQueueTimein interfaceCurrentlyBuilding- Specified by:
getQueueTimein interfaceExecutionStatus- Returns:
- Date - when the process was queued for execution
-
getVcsUpdateTime
@Nullable public @Nullable Date getVcsUpdateTime()
Description copied from interface:CurrentlyBuildingThe timeDatewhen updating / checking out source repository began- Specified by:
getVcsUpdateTimein interfaceCurrentlyBuilding- Returns:
-
setVcsUpdateTime
public void setVcsUpdateTime(@NotNull @NotNull Date vcsUpdateTime)- Specified by:
setVcsUpdateTimein interfaceCurrentlyBuilding
-
getElapsedTime
public long getElapsedTime()
Description copied from interface:ExecutionStatusHow long the task has taken up to now.- Specified by:
getElapsedTimein interfaceExecutionStatus- Returns:
- long representing task's elapsed time - in millis
-
isUpdatingVcs
public boolean isUpdatingVcs()
- Specified by:
isUpdatingVcsin interfaceCurrentlyBuilding
-
startTimer
public void startTimer()
Description copied from interface:CurrentlyBuildingStarts an internal timer to the currently running build- Specified by:
startTimerin interfaceCurrentlyBuilding
-
stopTimer
public void stopTimer()
Description copied from interface:CurrentlyBuildingStops the internal timer for the current running build- Specified by:
stopTimerin interfaceCurrentlyBuilding
-
setStartTime
public void setStartTime(long timestamp)
Description copied from interface:CurrentlyBuildingSets the start timestamp of the build. If there was the time already defined, it will not be overwritten and the passed value will be discarded.- Specified by:
setStartTimein interfaceCurrentlyBuilding
-
setStopTime
public void setStopTime(long timestamp)
Description copied from interface:CurrentlyBuildingSets the stop timestamp of the build. If there was the time already defined, it will not be overwritten and the passed value will be discarded.- Specified by:
setStopTimein interfaceCurrentlyBuilding
-
getBuildHangDetails
@Nullable public @Nullable BuildHungDetails getBuildHangDetails()
Description copied from interface:CurrentlyBuildingDetails about the build if it hung. Will be null if build was fine.- Specified by:
getBuildHangDetailsin interfaceCurrentlyBuilding- Returns:
-
setBuildHangDetails
public void setBuildHangDetails(@Nullable @Nullable BuildHungDetails buildHungDetails)Description copied from interface:CurrentlyBuildingSet the details if the build was detected to be hung.- Specified by:
setBuildHangDetailsin interfaceCurrentlyBuilding
-
getBuildCancelledDetails
@Nullable public @Nullable BuildCancelledDetails getBuildCancelledDetails()
- Specified by:
getBuildCancelledDetailsin interfaceCurrentlyBuilding
-
setBuildCancelledDetails
public void setBuildCancelledDetails(@Nullable @Nullable BuildCancelledDetails buildCancelledDetails)- Specified by:
setBuildCancelledDetailsin interfaceCurrentlyBuilding
-
getBuildQueueTimeoutDetails
public BuildQueueTimeoutDetails getBuildQueueTimeoutDetails()
Description copied from interface:CurrentlyBuildingDetails about the build if queue timeout was detected.- Specified by:
getBuildQueueTimeoutDetailsin interfaceCurrentlyBuilding- Returns:
-
setBuildQueueTimeoutDetails
public void setBuildQueueTimeoutDetails(BuildQueueTimeoutDetails buildQueueTimeoutDetails)
Description copied from interface:CurrentlyBuildingSets build queue timeout details- Specified by:
setBuildQueueTimeoutDetailsin interfaceCurrentlyBuilding
-
-