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 boolean
abortFinishing()
Attempt to stop finishing the build in case of database issues.boolean
equals(Object o)
@Nullable AgentType
getAgentType()
The current build agent type iff the build is current building on an agent.long
getAverageDuration()
Estimated total execution time of a task.@Nullable Long
getBuildAgentId()
The current build agent id iff the build is current building on an agent.@Nullable BuildCancelledDetails
getBuildCancelledDetails()
@NotNull BuildChanges
getBuildChanges()
Changes associated with current build@Nullable BuildHungDetails
getBuildHangDetails()
Details about the build if it hung.@NotNull BuildIdentifier
getBuildIdentifier()
The ID of the buildBuildQueueTimeoutDetails
getBuildQueueTimeoutDetails()
Details about the build if queue timeout was detected.@NotNull Map<String,String>
getCustomData()
Container for custom datalong
getElapsedTime()
How long the task has taken up to now.@NotNull PlanResultKey
getPlanResultKey()
@NotNull BuildProgressBar
getProgressBar()
Because of XStream deserialization we need to lazy initialize buildProgressBar in getter@NotNull Date
getQueueTime()
TheDate
when the build was originally queued@Nullable Date
getStartTime()
When was the execution started.@NotNull TriggerReason
getTriggerReason()
The trigger reason of the current build@Nullable Date
getVcsUpdateTime()
The timeDate
when updating / checking out source repository beganint
hashCode()
boolean
isCurrentlyQueuedOnly()
Is the build queued?boolean
isDetachedFromAgent()
Was it registered as building on agent, but agent requested another job since?boolean
isUpdatingVcs()
void
setAgentType(@Nullable AgentType agentType)
Sets the agent typevoid
setBuildAgentId(@Nullable Long buildAgentId)
Sets the fact that the build will now be building on an agentvoid
setBuildCancelledDetails(@Nullable BuildCancelledDetails buildCancelledDetails)
void
setBuildHangDetails(@Nullable BuildHungDetails buildHungDetails)
Set the details if the build was detected to be hung.void
setBuildQueueTimeoutDetails(BuildQueueTimeoutDetails buildQueueTimeoutDetails)
Sets build queue timeout detailsvoid
setStartTime(long timestamp)
Sets the start timestamp of the build.void
setStopTime(long timestamp)
Sets the stop timestamp of the build.void
setVcsUpdateTime(@NotNull Date vcsUpdateTime)
void
startTimer()
Starts an internal timer to the currently running buildvoid
stopTimer()
Stops the internal timer for the current running buildboolean
tryToFinish()
Attempt to mark this object for operation requiring exclusive access: i.e.void
updateCustomDataEntry(@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:ExecutionStatus
The ID of the build- Specified by:
getBuildIdentifier
in interfaceExecutionStatus
- Returns:
- buildIdentifier
-
getBuildChanges
@NotNull public @NotNull BuildChanges getBuildChanges()
Description copied from interface:ExecutionStatus
Changes associated with current build- Specified by:
getBuildChanges
in interfaceExecutionStatus
- Returns:
- buildChanges
-
getTriggerReason
@NotNull public @NotNull TriggerReason getTriggerReason()
Description copied from interface:ExecutionStatus
The trigger reason of the current build- Specified by:
getTriggerReason
in interfaceExecutionStatus
- Returns:
- triggerReason
-
getProgressBar
@NotNull public @NotNull BuildProgressBar getProgressBar()
Because of XStream deserialization we need to lazy initialize buildProgressBar in getter- Specified by:
getProgressBar
in interfaceExecutionStatus
- Returns:
- progressBar
-
getAverageDuration
public long getAverageDuration()
Description copied from interface:ExecutionStatus
Estimated total execution time of a task.- Specified by:
getAverageDuration
in interfaceExecutionStatus
- Returns:
- long representing estimated execution time - in millis
-
tryToFinish
public boolean tryToFinish()
Description copied from interface:CurrentlyBuilding
Attempt 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:
tryToFinish
in interfaceCurrentlyBuilding
- Returns:
- true iff thread is free to request removal of this object
-
abortFinishing
public boolean abortFinishing()
Description copied from interface:CurrentlyBuilding
Attempt to stop finishing the build in case of database issues.- Specified by:
abortFinishing
in interfaceCurrentlyBuilding
- Returns:
- true if there was an attempt to finish the build.
-
getBuildAgentId
@Nullable public @Nullable Long getBuildAgentId()
Description copied from interface:CurrentlyBuilding
The 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:
getBuildAgentId
in interfaceCurrentlyBuilding
- Returns:
- agent's id
-
setBuildAgentId
public void setBuildAgentId(@Nullable @Nullable Long buildAgentId)
Description copied from interface:CurrentlyBuilding
Sets the fact that the build will now be building on an agent- Specified by:
setBuildAgentId
in interfaceCurrentlyBuilding
- Parameters:
buildAgentId
- agent's id
-
getAgentType
@Nullable public @Nullable AgentType getAgentType()
Description copied from interface:CurrentlyBuilding
The 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:
getAgentType
in interfaceCurrentlyBuilding
- Returns:
- agent's type
-
getCustomData
@NotNull public @NotNull Map<String,String> getCustomData()
Description copied from interface:CurrentlyBuilding
Container for custom data- Specified by:
getCustomData
in interfaceCurrentlyBuilding
- Returns:
- map of key-value pairs
-
updateCustomDataEntry
public void updateCustomDataEntry(@NotNull @NotNull String key, @NotNull @NotNull String value)
Description copied from interface:BambooCustomDataAware
Add or modify key value pair to Object's custom data map.- Specified by:
updateCustomDataEntry
in interfaceBambooCustomDataAware
- Parameters:
key
- key to addvalue
- value to add
-
setAgentType
public void setAgentType(@Nullable @Nullable AgentType agentType)
Description copied from interface:CurrentlyBuilding
Sets the agent type- Specified by:
setAgentType
in interfaceCurrentlyBuilding
- Parameters:
agentType
- agent's type
-
isCurrentlyQueuedOnly
public boolean isCurrentlyQueuedOnly()
Description copied from interface:CurrentlyBuilding
Is the build queued?- Specified by:
isCurrentlyQueuedOnly
in interfaceCurrentlyBuilding
- Returns:
-
isDetachedFromAgent
public boolean isDetachedFromAgent()
Description copied from interface:CurrentlyBuilding
Was it registered as building on agent, but agent requested another job since?- Specified by:
isDetachedFromAgent
in interfaceCurrentlyBuilding
-
getStartTime
@Nullable public @Nullable Date getStartTime()
Description copied from interface:ExecutionStatus
When was the execution started.- Specified by:
getStartTime
in interfaceExecutionStatus
- Returns:
- Date - when the execution started
-
getQueueTime
@NotNull public @NotNull Date getQueueTime()
Description copied from interface:CurrentlyBuilding
TheDate
when the build was originally queued- Specified by:
getQueueTime
in interfaceCurrentlyBuilding
- Specified by:
getQueueTime
in interfaceExecutionStatus
- Returns:
- Date - when the process was queued for execution
-
getVcsUpdateTime
@Nullable public @Nullable Date getVcsUpdateTime()
Description copied from interface:CurrentlyBuilding
The timeDate
when updating / checking out source repository began- Specified by:
getVcsUpdateTime
in interfaceCurrentlyBuilding
- Returns:
-
setVcsUpdateTime
public void setVcsUpdateTime(@NotNull @NotNull Date vcsUpdateTime)
- Specified by:
setVcsUpdateTime
in interfaceCurrentlyBuilding
-
getElapsedTime
public long getElapsedTime()
Description copied from interface:ExecutionStatus
How long the task has taken up to now.- Specified by:
getElapsedTime
in interfaceExecutionStatus
- Returns:
- long representing task's elapsed time - in millis
-
isUpdatingVcs
public boolean isUpdatingVcs()
- Specified by:
isUpdatingVcs
in interfaceCurrentlyBuilding
-
startTimer
public void startTimer()
Description copied from interface:CurrentlyBuilding
Starts an internal timer to the currently running build- Specified by:
startTimer
in interfaceCurrentlyBuilding
-
stopTimer
public void stopTimer()
Description copied from interface:CurrentlyBuilding
Stops the internal timer for the current running build- Specified by:
stopTimer
in interfaceCurrentlyBuilding
-
setStartTime
public void setStartTime(long timestamp)
Description copied from interface:CurrentlyBuilding
Sets 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:
setStartTime
in interfaceCurrentlyBuilding
-
setStopTime
public void setStopTime(long timestamp)
Description copied from interface:CurrentlyBuilding
Sets 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:
setStopTime
in interfaceCurrentlyBuilding
-
getBuildHangDetails
@Nullable public @Nullable BuildHungDetails getBuildHangDetails()
Description copied from interface:CurrentlyBuilding
Details about the build if it hung. Will be null if build was fine.- Specified by:
getBuildHangDetails
in interfaceCurrentlyBuilding
- Returns:
-
setBuildHangDetails
public void setBuildHangDetails(@Nullable @Nullable BuildHungDetails buildHungDetails)
Description copied from interface:CurrentlyBuilding
Set the details if the build was detected to be hung.- Specified by:
setBuildHangDetails
in interfaceCurrentlyBuilding
-
getBuildCancelledDetails
@Nullable public @Nullable BuildCancelledDetails getBuildCancelledDetails()
- Specified by:
getBuildCancelledDetails
in interfaceCurrentlyBuilding
-
setBuildCancelledDetails
public void setBuildCancelledDetails(@Nullable @Nullable BuildCancelledDetails buildCancelledDetails)
- Specified by:
setBuildCancelledDetails
in interfaceCurrentlyBuilding
-
getBuildQueueTimeoutDetails
public BuildQueueTimeoutDetails getBuildQueueTimeoutDetails()
Description copied from interface:CurrentlyBuilding
Details about the build if queue timeout was detected.- Specified by:
getBuildQueueTimeoutDetails
in interfaceCurrentlyBuilding
- Returns:
-
setBuildQueueTimeoutDetails
public void setBuildQueueTimeoutDetails(BuildQueueTimeoutDetails buildQueueTimeoutDetails)
Description copied from interface:CurrentlyBuilding
Sets build queue timeout details- Specified by:
setBuildQueueTimeoutDetails
in interfaceCurrentlyBuilding
-
-