com.atlassian.bamboo.build
Class CurrentlyBuildingContainer

java.lang.Object
  extended by com.atlassian.bamboo.build.CurrentlyBuildingContainer
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean

@ThreadSafe
public class CurrentlyBuildingContainer
extends Object
implements org.springframework.beans.factory.InitializingBean

A class that allows thread safe maps of CurrentlyBuilding objects keyed by plan key and buildAgentId.

This bean registers itself as event listener via afterPropertiesSet() method.


Constructor Summary
CurrentlyBuildingContainer(AgentManager agentManager, ElasticImageConfigurationAccessor elasticImageConfigurationAccessor, com.atlassian.event.api.EventPublisher eventPublisher, XStreamFactory xStreamFactory)
           
 
Method Summary
 void afterPropertiesSet()
           
 CurrentlyBuilding getCurrentlyBuilding(long agentId)
           
 List<CurrentlyBuilding> getCurrentlyBuildingByKey(Key key)
          Immutable list of currently building by plan.
 CurrentlyBuilding getCurrentlyBuildingByResultKey(ResultKey resultKey)
           
 Iterable<CurrentlyBuilding> getCurrentlyExecuting()
           
 int numberOfCurrentlyBuildingForKey(Key key)
           
 void onAgentAssignedTimingPoint(BuildTimingPoints.AgentAssigned event)
           
 CurrentlyBuilding removeCurrentlyBuilding(ResultKey resultKey)
           
 Set<ResultKey> restoreState(Set<PlanResultKey> pendingBuildKeys)
           
protected  void saveState(CurrentlyBuilding currentlyBuilding)
           
 CurrentlyBuilding setCurrentlyBuilding(BuildContext buildContext, CurrentlyBuilding currentlyBuilding, Collection<BuildAgent> executableAgents, Collection<ElasticImageConfiguration> executableImages)
           
 CurrentlyBuilding startBuildingOnAgent(PlanResultKey planResultKey, long agentId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CurrentlyBuildingContainer

public CurrentlyBuildingContainer(AgentManager agentManager,
                                  ElasticImageConfigurationAccessor elasticImageConfigurationAccessor,
                                  com.atlassian.event.api.EventPublisher eventPublisher,
                                  XStreamFactory xStreamFactory)
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

onAgentAssignedTimingPoint

@EventListener
public void onAgentAssignedTimingPoint(@NotNull
                                                     BuildTimingPoints.AgentAssigned event)

getCurrentlyBuildingByKey

public List<CurrentlyBuilding> getCurrentlyBuildingByKey(Key key)
Immutable list of currently building by plan.


numberOfCurrentlyBuildingForKey

public int numberOfCurrentlyBuildingForKey(Key key)

getCurrentlyExecuting

@NotNull
public Iterable<CurrentlyBuilding> getCurrentlyExecuting()
Returns:
currently building things.

getCurrentlyBuildingByResultKey

@Nullable
public CurrentlyBuilding getCurrentlyBuildingByResultKey(@NotNull
                                                                  ResultKey resultKey)

getCurrentlyBuilding

@Nullable
public CurrentlyBuilding getCurrentlyBuilding(long agentId)

setCurrentlyBuilding

@NotNull
public CurrentlyBuilding setCurrentlyBuilding(@NotNull
                                                      BuildContext buildContext,
                                                      @NotNull
                                                      CurrentlyBuilding currentlyBuilding,
                                                      Collection<BuildAgent> executableAgents,
                                                      Collection<ElasticImageConfiguration> executableImages)

startBuildingOnAgent

@NotNull
public CurrentlyBuilding startBuildingOnAgent(@NotNull
                                                      PlanResultKey planResultKey,
                                                      long agentId)

removeCurrentlyBuilding

@Nullable
public CurrentlyBuilding removeCurrentlyBuilding(@NotNull
                                                          ResultKey resultKey)

restoreState

public Set<ResultKey> restoreState(Set<PlanResultKey> pendingBuildKeys)
Parameters:
pendingBuildKeys -
Returns:
keys of restored results

saveState

protected void saveState(CurrentlyBuilding currentlyBuilding)


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.