Package com.atlassian.bamboo.plan
Class PlanExecutionLockServiceImpl
java.lang.Object
com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl
- All Implemented Interfaces:
PlanExecutionLockService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<V> VinlineProcessLocks(@NotNull TriggerableInternalKey internalKey, @NotNull AcquisitionPolicy acquisitionPolicy, @NotNull Callable<V> callable) A parallel locking mechanism that allows a backdoor to the standard lock.voidinterruptLockOwner(@NotNull TriggerableInternalKey internalKey) Interrupts the owner of the lock represented byTriggerableInternalKeybooleanisLocked(@NotNull TriggerableInternalKey internalKey) Checks if the givenStringhas been locked<V> Vlock(@NotNull TriggerableInternalKey internalKey, @NotNull AcquisitionPolicy acquisitionPolicy, @NotNull Callable<V> callable) Quick note about the implementation Since the acquisition policyAcquisitionPolicy.WAITcan block for an indefinite amount of time we acquire this lock before trying to take the global execution lock otherwise callers torunWhenNoExecutionRequestsAreBeingMade(Callable)in the worst case will wait indefinitely.<V> VrunWhenNoExecutionRequestsAreBeingMade(@NotNull Callable<V> callable) Executes the givenCallablewhen there are no requests being made to execute plans
-
Constructor Details
-
PlanExecutionLockServiceImpl
public PlanExecutionLockServiceImpl()
-
-
Method Details
-
runWhenNoExecutionRequestsAreBeingMade
public <V> V runWhenNoExecutionRequestsAreBeingMade(@NotNull @NotNull Callable<V> callable) throws Exception Description copied from interface:PlanExecutionLockServiceExecutes the givenCallablewhen there are no requests being made to execute plans- Specified by:
runWhenNoExecutionRequestsAreBeingMadein interfacePlanExecutionLockService- Type Parameters:
V- callable result type- Parameters:
callable- to execute- Returns:
- callable result
- Throws:
Exception- if error
-
isLocked
Description copied from interface:PlanExecutionLockServiceChecks if the givenStringhas been locked- Specified by:
isLockedin interfacePlanExecutionLockService- Parameters:
internalKey- to check- Returns:
- locked state
-
lock
@Nullable public <V> V lock(@NotNull @NotNull TriggerableInternalKey internalKey, @NotNull @NotNull AcquisitionPolicy acquisitionPolicy, @NotNull @NotNull Callable<V> callable) throws Exception Quick note about the implementation Since the acquisition policyAcquisitionPolicy.WAITcan block for an indefinite amount of time we acquire this lock before trying to take the global execution lock otherwise callers torunWhenNoExecutionRequestsAreBeingMade(Callable)in the worst case will wait indefinitely.- Specified by:
lockin interfacePlanExecutionLockService- Type Parameters:
V- callable result type- Parameters:
internalKey- to lockacquisitionPolicy- to acquire the lockcallable- to execute- Returns:
- callable result
- Throws:
Exception- if error
-
inlineProcessLocks
@Nullable public <V> V inlineProcessLocks(@NotNull @NotNull TriggerableInternalKey internalKey, @NotNull @NotNull AcquisitionPolicy acquisitionPolicy, @NotNull @NotNull Callable<V> callable) throws Exception Description copied from interface:PlanExecutionLockServiceA parallel locking mechanism that allows a backdoor to the standard lock. This should only be used for short lived locking (whereas the standard lock might be used for change detection). This is by convention only, so take care. This lock will participate inPlanExecutionLockService.isLocked(TriggerableInternalKey)andPlanExecutionLockService.interruptLockOwner(TriggerableInternalKey)- Specified by:
inlineProcessLocksin interfacePlanExecutionLockService- Type Parameters:
V-- Parameters:
internalKey-acquisitionPolicy-callable-- Returns:
- Throws:
Exception
-
interruptLockOwner
Description copied from interface:PlanExecutionLockServiceInterrupts the owner of the lock represented byTriggerableInternalKey- Specified by:
interruptLockOwnerin interfacePlanExecutionLockService- Parameters:
internalKey-
-