Package com.atlassian.bamboo.chains
Class ChainExecutionManagerImpl
java.lang.Object
com.atlassian.bamboo.chains.ChainExecutionManagerImpl
- All Implemented Interfaces:
ChainExecutionAccessor,ChainExecutionManager
This class is registered as event listener
postConstruct()-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionChainExecutionManagerImpl(PlanStatePersisterService planStatePersisterService, JobExecutionManager buildContextExecutor, ChainStateFactory chainStateFactory, BuildContextFactory buildContextFactory, com.atlassian.event.api.EventPublisher eventPublisher, ChainPluginSupport chainPluginSupport, ErrorUpdateHandler errorUpdateHandler, AuthorCreatorService authorCreatorService, ResultsSummaryManager resultsSummaryManager, BuildDirectoryManager buildDirectoryManager, VcsBranchIntegrationHelper branchIntegrationHelper, CustomVariableContext customVariableContext, PlanExecutionLockService planExecutionLockService, PlanVcsRevisionHistoryService planVcsRevisionHistoryService, CachedPlanManager cachedPlanManager, VcsRepositoryManager vcsRepositoryManager, StorageTagService storageTagService, PlanBranchPullRequestService planBranchPullRequestService, StorageLocationService storageLocationService, ServerBuildLoggerManager buildLoggerManager, DeploymentVersionService deploymentVersionService, ChainStatePersister chainStatePersister, BambooOpenSessionTemplate bambooOpenSessionTemplate) -
Method Summary
Modifier and TypeMethodDescription@NotNull ChainStateCreationRequestResultcreateChainStateNoDetection(@NotNull ImmutableChain chain, @NotNull UnconditionalBuildDetectionAction buildDetectionAction) Create a chain state ready for building but dont actually build.@NotNull ChainExecutionRequestResultdelayedStart(@NotNull ImmutableChain chain, @NotNull UnconditionalBuildDetectionAction buildDetectionAction, @NotNull ChainState chainState) Starts the Chain if it's been created alreadydelayedStart(@NotNull ImmutableChain chain, @NotNull UnconditionalBuildDetectionAction buildDetectionAction, @NotNull ChainState chainState, PlanExecutionLaunchControl.ReleaseLocksActions releaseLocksActions) Starts the Chain if it's been created already@Nullable ChainExecutiongetChainExecution(@NotNull PlanResultKey planResultKey) Get the state of the single ChainExecution@NotNull List<ChainExecution> getExecutingChains(@NotNull PlanKey planKey) Get the Collection of the state of the ChainExecution or empty collection when no chain is executing@NotNull List<ChainExecution> getFlatExecutingChains(@NotNull PlanKey planKey) Get the Collection of the state of the ChainExecution or empty collection when no chain is executing.@Nullable BuildExecutiongetJobExecution(@NotNull PlanResultKey planResultKey) Get the state of a single Job being executedbooleanChecks if theChainis "active" ie being queued, or buildingbooleanisExecuting(@NotNull PlanKey planKey) Checks if the Chain is buildingbooleanisExecuting(@NotNull PlanResultKey planResultKey) Checks ofBuildResultsSummaryrepresented byPlanResultKeyis currently building (ie started on an agent_voidLog activeChainExecutionsintintnumberOfChainsExecuting(@NotNull PlanKey planKey) Determines the number ofChainExecutions are active for the givenPlanKeyvoidonBuildFinished(BuildFinishedEvent buildFinishedEvent) voidonChainRemoved(@NotNull ChainDeletedEvent chainDeletedEvent) voidonChainRemoved(@NotNull MultipleChainsDeletedEvent chainDeletedEvent) voidrestoreState(Set<PlanResultKey> chainResultsToRestore, Map<PlanResultKey, BuildResultsSummary> jobsInProgress, ExecutorService executorService) Restores the state of running chains after server restart on custom-provided executor service.@NotNull ChainExecutionRequestResultstart(@NotNull ImmutableChain chain, @NotNull ConditionalBuildDetectionAction buildDetectionAction) Starts the Chainvoidvoidstop(@NotNull PlanResultKey planResultKey) Stops the executing instance of theChainrepresented byPlanResultKeyprotected void
-
Field Details
-
MERGE_DIR
- See Also:
-
-
Constructor Details
-
ChainExecutionManagerImpl
public ChainExecutionManagerImpl(PlanStatePersisterService planStatePersisterService, JobExecutionManager buildContextExecutor, ChainStateFactory chainStateFactory, BuildContextFactory buildContextFactory, com.atlassian.event.api.EventPublisher eventPublisher, ChainPluginSupport chainPluginSupport, ErrorUpdateHandler errorUpdateHandler, AuthorCreatorService authorCreatorService, ResultsSummaryManager resultsSummaryManager, BuildDirectoryManager buildDirectoryManager, VcsBranchIntegrationHelper branchIntegrationHelper, CustomVariableContext customVariableContext, PlanExecutionLockService planExecutionLockService, PlanVcsRevisionHistoryService planVcsRevisionHistoryService, CachedPlanManager cachedPlanManager, VcsRepositoryManager vcsRepositoryManager, StorageTagService storageTagService, PlanBranchPullRequestService planBranchPullRequestService, StorageLocationService storageLocationService, ServerBuildLoggerManager buildLoggerManager, DeploymentVersionService deploymentVersionService, ChainStatePersister chainStatePersister, BambooOpenSessionTemplate bambooOpenSessionTemplate)
-
-
Method Details
-
start
@NotNull public @NotNull ChainExecutionRequestResult start(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull ConditionalBuildDetectionAction buildDetectionAction) Description copied from interface:ChainExecutionManagerStarts the Chain- Specified by:
startin interfaceChainExecutionManager- Parameters:
chain-buildDetectionAction-- Returns:
- success or null if chain execution has not been started
-
delayedStart
@NotNull public @NotNull ChainExecutionRequestResult delayedStart(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull UnconditionalBuildDetectionAction buildDetectionAction, @NotNull @NotNull ChainState chainState) Description copied from interface:ChainExecutionManagerStarts the Chain if it's been created already- Specified by:
delayedStartin interfaceChainExecutionManager- Parameters:
chain-buildDetectionAction-chainState- if already created- Returns:
- success or null if chain execution has not been started
-
delayedStart
public ChainExecutionRequestResult delayedStart(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull UnconditionalBuildDetectionAction buildDetectionAction, @NotNull @NotNull ChainState chainState, @NotNull PlanExecutionLaunchControl.ReleaseLocksActions releaseLocksActions) Description copied from interface:ChainExecutionManagerStarts the Chain if it's been created already- Specified by:
delayedStartin interfaceChainExecutionManager- Parameters:
chain-buildDetectionAction-chainState- if already createdreleaseLocksActions- actions used for releasing repositories caches locks- Returns:
- success or null if chain execution has not been started since 9.3
-
onChainRemoved
-
onChainRemoved
@EventListener public void onChainRemoved(@NotNull @NotNull MultipleChainsDeletedEvent chainDeletedEvent) -
onJobSentToAgent
-
onBuildFinished
-
createChainStateNoDetection
@NotNull public @NotNull ChainStateCreationRequestResult createChainStateNoDetection(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull UnconditionalBuildDetectionAction buildDetectionAction) Description copied from interface:ChainExecutionManagerCreate a chain state ready for building but dont actually build.- Specified by:
createChainStateNoDetectionin interfaceChainExecutionManager- Parameters:
chain-buildDetectionAction-- Returns:
-
stop
Description copied from interface:ChainExecutionManagerStops the executing instance of theChainrepresented byPlanResultKey- Specified by:
stopin interfaceChainExecutionManager- Parameters:
planResultKey-
-
stop
Description copied from interface:ChainExecutionManager- Specified by:
stopin interfaceChainExecutionManager- Parameters:
planKey-
-
isActive
Description copied from interface:ChainExecutionAccessorChecks if theChainis "active" ie being queued, or building- Specified by:
isActivein interfaceChainExecutionAccessor- Parameters:
planKey-- Returns:
- active
-
isExecuting
Description copied from interface:ChainExecutionAccessorChecks if the Chain is building- Specified by:
isExecutingin interfaceChainExecutionAccessor- Parameters:
planKey-- Returns:
- running
-
isExecuting
Description copied from interface:ChainExecutionAccessorChecks ofBuildResultsSummaryrepresented byPlanResultKeyis currently building (ie started on an agent_- Specified by:
isExecutingin interfaceChainExecutionAccessor- Parameters:
planResultKey-- Returns:
- executing
-
getExecutingChains
Description copied from interface:ChainExecutionAccessorGet the Collection of the state of the ChainExecution or empty collection when no chain is executing- Specified by:
getExecutingChainsin interfaceChainExecutionAccessor- Parameters:
planKey-- Returns:
- list of chain executions
-
getFlatExecutingChains
@NotNull public @NotNull List<ChainExecution> getFlatExecutingChains(@NotNull @NotNull PlanKey planKey) Description copied from interface:ChainExecutionAccessorGet the Collection of the state of the ChainExecution or empty collection when no chain is executing. Flat means no stages or jobs data is included.- Specified by:
getFlatExecutingChainsin interfaceChainExecutionAccessor- Parameters:
planKey- plan key- Returns:
- list of flat chain executions
-
getChainExecution
@Nullable public @Nullable ChainExecution getChainExecution(@NotNull @NotNull PlanResultKey planResultKey) Description copied from interface:ChainExecutionAccessorGet the state of the single ChainExecution- Specified by:
getChainExecutionin interfaceChainExecutionAccessor- Parameters:
planResultKey-- Returns:
-
getJobExecution
@Nullable public @Nullable BuildExecution getJobExecution(@NotNull @NotNull PlanResultKey planResultKey) Description copied from interface:ChainExecutionAccessorGet the state of a single Job being executed- Specified by:
getJobExecutionin interfaceChainExecutionAccessor- Parameters:
planResultKey-- Returns:
-
numberOfChainsExecuting
Description copied from interface:ChainExecutionAccessorDetermines the number ofChainExecutions are active for the givenPlanKey- Specified by:
numberOfChainsExecutingin interfaceChainExecutionAccessor- Parameters:
planKey-- Returns:
-
logChainExecutionState
public void logChainExecutionState()Description copied from interface:ChainExecutionAccessorLog activeChainExecutions- Specified by:
logChainExecutionStatein interfaceChainExecutionAccessor
-
numberOfChainsExecuting
public int numberOfChainsExecuting()- Specified by:
numberOfChainsExecutingin interfaceChainExecutionAccessor- Returns:
- total number of active
ChainExecutions
-
restoreState
public Set<PlanResultKey> restoreState(Set<PlanResultKey> chainResultsToRestore, Map<PlanResultKey, BuildResultsSummary> jobsInProgress, ExecutorService executorService) throws ExecutionException, InterruptedExceptionDescription copied from interface:ChainExecutionManagerRestores the state of running chains after server restart on custom-provided executor service.- Specified by:
restoreStatein interfaceChainExecutionManager- Returns:
- keys of jobs that are running according to stored chain states.
- Throws:
ExecutionExceptionInterruptedException
-
useDirectExecutor
protected void useDirectExecutor()
-