Package com.atlassian.bamboo.plan
Class NonBlockingPlanExecutionServiceImpl
- java.lang.Object
-
- com.atlassian.bamboo.plan.NonBlockingPlanExecutionServiceImpl
-
- All Implemented Interfaces:
NonBlockingPlanExecutionService
public class NonBlockingPlanExecutionServiceImpl extends Object implements NonBlockingPlanExecutionService
-
-
Field Summary
Fields Modifier and Type Field Description protected EventLoggingThreadPoolExecutor
executor
protected PlanExecutionLaunchControl
planExecutionLaunchControl
-
Constructor Summary
Constructors Modifier Constructor Description NonBlockingPlanExecutionServiceImpl(PlanExecutionManager planExecutionManager)
protected
NonBlockingPlanExecutionServiceImpl(PlanExecutionManager planExecutionManager, int maximumThreadCount, long threadIdleTimeout)
protected
NonBlockingPlanExecutionServiceImpl(PlanExecutionManager planExecutionManager, EventLoggingThreadPoolExecutor executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
enqueueTrigger(@NotNull Triggerable triggerable, @NotNull Long triggerId, @NotNull BuildDetectionAction buildDetectionAction)
@NotNull ExecutorStats
getExecutorStats()
Stats for the underlyingThreadPoolExecutor
@NotNull QueueActivityStatsDto
getQueueActivityStatsAndRestoreToInitialState()
Gets analytical data from queue activity tracker and bring its initial state - start data collecting from scratch.Future<Boolean>
shutdown()
Stop accepting any more trigger requests.@Nullable Future<ExecutionRequestResult>
tryToStart(@NotNull Triggerable triggerable, @NotNull BuildDetectionAction buildDetectionAction)
-
-
-
Field Detail
-
planExecutionLaunchControl
protected final PlanExecutionLaunchControl planExecutionLaunchControl
-
executor
protected final EventLoggingThreadPoolExecutor executor
-
-
Constructor Detail
-
NonBlockingPlanExecutionServiceImpl
public NonBlockingPlanExecutionServiceImpl(PlanExecutionManager planExecutionManager)
-
NonBlockingPlanExecutionServiceImpl
protected NonBlockingPlanExecutionServiceImpl(PlanExecutionManager planExecutionManager, int maximumThreadCount, long threadIdleTimeout)
-
NonBlockingPlanExecutionServiceImpl
protected NonBlockingPlanExecutionServiceImpl(PlanExecutionManager planExecutionManager, EventLoggingThreadPoolExecutor executor)
-
-
Method Detail
-
enqueueTrigger
public void enqueueTrigger(@NotNull @NotNull Triggerable triggerable, @NotNull @NotNull Long triggerId, @NotNull @NotNull BuildDetectionAction buildDetectionAction)
Description copied from interface:NonBlockingPlanExecutionService
Submits a background task to runPlanExecutionManager.start(com.atlassian.bamboo.plan.cache.ImmutableChain, com.atlassian.bamboo.build.BuildDetectionAction, com.atlassian.bamboo.util.AcquisitionPolicy)
. Only oneAcquisitionPolicy.IMMEDIATE
per planKey + triggerId combination will be queued at any point in time. The task are not guaranteed to be run, they might get dropped ifNonBlockingPlanExecutionService.tryToStart(Triggerable, BuildDetectionAction)
is called. Rationale is: conditional triggers won't start anyway if there's a 'guaranteed' build run.To be used with automatic triggers: any auto Trigger can have Trigger Conditions defined
- Specified by:
enqueueTrigger
in interfaceNonBlockingPlanExecutionService
-
tryToStart
@Nullable public @Nullable Future<ExecutionRequestResult> tryToStart(@NotNull @NotNull Triggerable triggerable, @NotNull @NotNull BuildDetectionAction buildDetectionAction)
Description copied from interface:NonBlockingPlanExecutionService
Submits a background task to runPlanExecutionManager.start(com.atlassian.bamboo.plan.cache.ImmutableChain, com.atlassian.bamboo.build.BuildDetectionAction, com.atlassian.bamboo.util.AcquisitionPolicy)
. The task usesAcquisitionPolicy.WAIT
. To be used for triggers that are 'unconditional'. In other words, the method should be used for cases where build absolutely, positively needs to trigger (unless encountering internal error or hitting concurrent build limit)- Specified by:
tryToStart
in interfaceNonBlockingPlanExecutionService
- Returns:
-
shutdown
public Future<Boolean> shutdown()
Description copied from interface:NonBlockingPlanExecutionService
Stop accepting any more trigger requests.- Specified by:
shutdown
in interfaceNonBlockingPlanExecutionService
-
getExecutorStats
@NotNull public @NotNull ExecutorStats getExecutorStats()
Description copied from interface:NonBlockingPlanExecutionService
Stats for the underlyingThreadPoolExecutor
- Specified by:
getExecutorStats
in interfaceNonBlockingPlanExecutionService
- Returns:
-
getQueueActivityStatsAndRestoreToInitialState
@NotNull public @NotNull QueueActivityStatsDto getQueueActivityStatsAndRestoreToInitialState()
Description copied from interface:NonBlockingPlanExecutionService
Gets analytical data from queue activity tracker and bring its initial state - start data collecting from scratch.- Specified by:
getQueueActivityStatsAndRestoreToInitialState
in interfaceNonBlockingPlanExecutionService
- Returns:
- QueueActivityStatsDto with stat amounts
-
-